Store columns and fields in insertion order in RelationModel

Using a TreeMap to store column names causes them to be iterated in
sorted order when generating the SQL SELECT/INSERT clause in e.g.
RelationalModel.getInsertOneSQL. In the code to generate bytecode for
binding values to PreparedStatements for those same statements, in e.g.
AccessGen.implementBindOne, however, it uses the original insertion
order of the fields, and expands nested fields recursively in-place.
Since column names belonging to nested fields don't have any sort of
prefix, this means they get sorted at arbitrary places in the full
list of column names. This causes at best type mismatches[1] and at
worst corrupt data.

Change the column names in RelationModel to use the same original
iteration order that comes out of the JavaRelationModel. This calls
Class.getDeclaredFields and is thus not guaranteed stable across runs
in Java 7+, but for our purposes it just needs to be stable across a
single run.

This change is much simpler to implement than changing the iteration
order in the generated bytecode.

[1] For example:
org.h2.jdbc.JdbcSQLException: Data conversion error converting "'N'
(ACCOUNTS: MAXIMUM_PAGE_SIZE SMALLINT DEFAULT 0 NOT NULL)"; SQL
statement: INSERT INTO accounts(contact_filed_on,copy_self_on_email,
date_format,download_command,download_url,full_name,inactive,
maximum_page_size,preferred_email,registered_on,
reverse_patch_set_order,show_site_header,
show_username_in_review_category,time_format,use_flash_clipboard,
account_id)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) -- (?1, ?2, ?3, ?4,
?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16)

Change-Id: Ie8439a199ce74cb85e2a6f1cc2b981bce22c278d
diff --git a/src/main/java/com/google/gwtorm/schema/RelationModel.java b/src/main/java/com/google/gwtorm/schema/RelationModel.java
index dfa3753..363960e 100644
--- a/src/main/java/com/google/gwtorm/schema/RelationModel.java
+++ b/src/main/java/com/google/gwtorm/schema/RelationModel.java
@@ -14,6 +14,8 @@
 
 package com.google.gwtorm.schema;
 
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import com.google.gwtorm.schema.sql.SqlDialect;
 import com.google.gwtorm.server.OrmException;
 import com.google.gwtorm.server.PrimaryKey;
@@ -26,7 +28,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.SortedMap;
-import java.util.TreeMap;
 
 public abstract class RelationModel {
   protected String methodName;
@@ -39,10 +40,10 @@
   protected Collection<QueryModel> queries;
 
   protected RelationModel() {
-    fieldsByFieldName = new TreeMap<String, ColumnModel>();
-    columnsByColumnName = new TreeMap<String, ColumnModel>();
-    columnsById = new TreeMap<Integer, ColumnModel>();
-    queries = new ArrayList<QueryModel>();
+    fieldsByFieldName = Maps.newLinkedHashMap();
+    columnsByColumnName = Maps.newLinkedHashMap();
+    columnsById = Maps.newTreeMap();
+    queries = Lists.newArrayList();
   }
 
   protected void initName(final String method, final Relation rel)