You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by jg...@apache.org on 2008/06/05 21:40:23 UTC

svn commit: r663717 [2/2] - in /ibatis/trunk/java/tools/ibator/core: build/ doc/ htmldoc/ htmldoc/configreference/ src/org/apache/ibatis/ibator/ant/ src/org/apache/ibatis/ibator/api/ src/org/apache/ibatis/ibator/config/ src/org/apache/ibatis/ibator/con...

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/model/JavaModelGeneratorJava2Impl.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/model/JavaModelGeneratorJava2Impl.java?rev=663717&r1=663716&r2=663717&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/model/JavaModelGeneratorJava2Impl.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/model/JavaModelGeneratorJava2Impl.java Thu Jun  5 12:40:22 2008
@@ -87,23 +87,10 @@
      */
     protected Properties properties;
 
-    /**
-     * The target package from the JavaModelGenerator congiguration element
-     */
-    protected String targetPackage;
-
-    /**
-     * The target project from the JavaModelGenerator congiguration element
-     */
-    protected String targetProject;
-
-    private Map<FullyQualifiedTable, Map<String, Object>> tableValueMaps;
-
     private Map<String, PropertyDescriptor[]> propertyDescriptorMap;
     
     public JavaModelGeneratorJava2Impl() {
         super();
-        tableValueMaps = new HashMap<FullyQualifiedTable, Map<String, Object>>();
         properties = new Properties();
         propertyDescriptorMap = new HashMap<String, PropertyDescriptor[]>();
     }
@@ -112,25 +99,6 @@
         this.properties.putAll(properties);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.ibatis.ibator.api.JavaModelGenerator#setTargetPackage(java.lang.String)
-     */
-    public void setTargetPackage(String targetPackage) {
-        this.targetPackage = targetPackage;
-    }
-
-    private Map<String, Object> getTableValueMap(FullyQualifiedTable table) {
-        Map<String, Object> map = tableValueMaps.get(table);
-        if (map == null) {
-            map = new HashMap<String, Object>();
-            tableValueMaps.put(table, map);
-        }
-
-        return map;
-    }
-
     /**
      * Adds fields and getter/setter methods for each ColumnDefinition passed
      * into the method.
@@ -231,40 +199,14 @@
         }
     }
 
-    /**
-     * Calculates the package for generated domain objects.
-     * 
-     * @param table
-     *            the current table
-     * @return the calculated package
-     */
-    protected String getJavaModelPackage(FullyQualifiedTable table) {
-        String key = "getJavaModelPackage"; //$NON-NLS-1$
-        String s;
-
-        Map<String, Object> map = getTableValueMap(table);
-        s = (String) map.get(key);
-        if (s == null) {
-            StringBuffer sb = new StringBuffer(targetPackage);
-            if ("true".equalsIgnoreCase(properties.getProperty(PropertyRegistry.ANY_ENABLE_SUB_PACKAGES))) { //$NON-NLS-1$
-                sb.append(table.getSubPackage());
-            }
-            
-            s = sb.toString();
-            map.put(key, s);
-        }
-
-        return s;
-    }
-
     protected TopLevelClass getPrimaryKey(IntrospectedTable introspectedTable) {
 
         if (!introspectedTable.getRules().generatePrimaryKeyClass()) {
             return null;
         }
 
-        FullyQualifiedTable table = introspectedTable.getTable();
-        FullyQualifiedJavaType type = getPrimaryKeyType(table);
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType type = introspectedTable.getPrimaryKeyType();
         TopLevelClass answer = new TopLevelClass(type);
         answer.setVisibility(JavaVisibility.PUBLIC);
         ibatorContext.getCommentGenerator().addJavaFileComment(answer);
@@ -287,14 +229,14 @@
             return null;
         }
 
-        FullyQualifiedTable table = introspectedTable.getTable();
-        FullyQualifiedJavaType type = getBaseRecordType(table);
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType type = introspectedTable.getBaseRecordType();
         TopLevelClass answer = new TopLevelClass(type);
         answer.setVisibility(JavaVisibility.PUBLIC);
         ibatorContext.getCommentGenerator().addJavaFileComment(answer);
         
         if (introspectedTable.getRules().generatePrimaryKeyClass()) {
-            answer.setSuperClass(getPrimaryKeyType(table));
+            answer.setSuperClass(introspectedTable.getPrimaryKeyType());
         } else {
             String rootClass = getRootClass(introspectedTable);
             if (rootClass != null) {
@@ -327,16 +269,16 @@
             return null;
         }
 
-        FullyQualifiedTable table = introspectedTable.getTable();
-        FullyQualifiedJavaType type = getRecordWithBLOBsType(table);
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType type = introspectedTable.getRecordWithBLOBsType();
         TopLevelClass answer = new TopLevelClass(type);
         answer.setVisibility(JavaVisibility.PUBLIC);
         ibatorContext.getCommentGenerator().addJavaFileComment(answer);
         
         if (introspectedTable.getRules().generateBaseRecordClass()) {
-            answer.setSuperClass(getBaseRecordType(table));
+            answer.setSuperClass(introspectedTable.getBaseRecordType());
         } else {
-            answer.setSuperClass(getPrimaryKeyType(table));
+            answer.setSuperClass(introspectedTable.getPrimaryKeyType());
         }
         
         generateClassParts(table, introspectedTable.getBLOBColumns(), answer,
@@ -345,34 +287,6 @@
         return answer;
     }
 
-    public void setTargetProject(String targetProject) {
-        this.targetProject = targetProject;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.ibatis.ibator.api.JavaModelGenerator#getExampleType(org.apache.ibatis.ibator.config.FullyQualifiedTable)
-     */
-    public FullyQualifiedJavaType getExampleType(FullyQualifiedTable table) {
-        String key = "getExampleType"; //$NON-NLS-1$
-
-        Map<String, Object> map = getTableValueMap(table);
-        FullyQualifiedJavaType fqjt = (FullyQualifiedJavaType) map.get(key);
-        if (fqjt == null) {
-            StringBuffer sb = new StringBuffer();
-            sb.append(getJavaModelPackage(table));
-            sb.append('.');
-            sb.append(table.getDomainObjectName());
-            sb.append("Example"); //$NON-NLS-1$
-
-            fqjt = new FullyQualifiedJavaType(sb.toString());
-            map.put(key, fqjt);
-        }
-
-        return fqjt;
-    }
-
     /*
      *  (non-Javadoc)
      * @see org.apache.ibatis.ibator.api.JavaModelGenerator#getGeneratedJavaFiles(org.apache.ibatis.ibator.api.IntrospectedTable, org.apache.ibatis.ibator.api.ProgressCallback)
@@ -380,10 +294,11 @@
     public List<GeneratedJavaFile> getGeneratedJavaFiles(IntrospectedTable introspectedTable, ProgressCallback callback) {
         List<GeneratedJavaFile> list = new ArrayList<GeneratedJavaFile>();
         IbatorPlugin plugins = ibatorContext.getPlugins();
+        String targetProject = ibatorContext.getJavaModelGeneratorConfiguration().getTargetProject();
 
         callback.startSubTask(Messages.getString(
                 "Progress.6", //$NON-NLS-1$
-                introspectedTable.getTable().toString()));
+                introspectedTable.getFullyQualifiedTable().toString()));
         TopLevelClass tlc = getExample(introspectedTable);
         if (tlc != null) {
             if (plugins.modelExampleClassGenerated(tlc, introspectedTable)) {
@@ -394,7 +309,7 @@
 
         callback.startSubTask(Messages.getString(
                 "Progress.7", //$NON-NLS-1$
-                introspectedTable.getTable().toString()));
+                introspectedTable.getFullyQualifiedTable().toString()));
         tlc = getPrimaryKey(introspectedTable);
         if (tlc != null) {
             if (plugins.modelPrimaryKeyClassGenerated(tlc, introspectedTable)) {
@@ -405,7 +320,7 @@
 
         callback.startSubTask(Messages.getString(
                 "Progress.8", //$NON-NLS-1$
-                introspectedTable.getTable().toString()));
+                introspectedTable.getFullyQualifiedTable().toString()));
         tlc = getBaseRecord(introspectedTable);
         if (tlc != null) {
             if (plugins.modelBaseRecordClassGenerated(tlc, introspectedTable)) {
@@ -416,7 +331,7 @@
 
         callback.startSubTask(Messages.getString(
                 "Progress.9", //$NON-NLS-1$
-                introspectedTable.getTable().toString()));
+                introspectedTable.getFullyQualifiedTable().toString()));
         tlc = getRecordWithBLOBs(introspectedTable);
         if (tlc != null) {
             if (plugins.modelRecordWithBLOBsClassGenerated(tlc, introspectedTable)) {
@@ -431,78 +346,6 @@
     /*
      * (non-Javadoc)
      * 
-     * @see org.apache.ibatis.ibator.api.JavaModelGenerator#getPrimaryKeyType(org.apache.ibatis.ibator.config.FullyQualifiedTable)
-     */
-    public FullyQualifiedJavaType getPrimaryKeyType(FullyQualifiedTable table) {
-        String key = "getPrimaryKeyType"; //$NON-NLS-1$
-
-        Map<String, Object> map = getTableValueMap(table);
-        FullyQualifiedJavaType fqjt = (FullyQualifiedJavaType) map.get(key);
-        if (fqjt == null) {
-            StringBuffer sb = new StringBuffer();
-            sb.append(getJavaModelPackage(table));
-            sb.append('.');
-            sb.append(table.getDomainObjectName());
-            sb.append("Key"); //$NON-NLS-1$
-
-            fqjt = new FullyQualifiedJavaType(sb.toString());
-            map.put(key, fqjt);
-        }
-
-        return fqjt;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.ibatis.ibator.api.JavaModelGenerator#getRecordType(org.apache.ibatis.ibator.config.FullyQualifiedTable)
-     */
-    public FullyQualifiedJavaType getBaseRecordType(FullyQualifiedTable table) {
-        String key = "getRecordType"; //$NON-NLS-1$
-
-        Map<String, Object> map = getTableValueMap(table);
-        FullyQualifiedJavaType fqjt = (FullyQualifiedJavaType) map.get(key);
-        if (fqjt == null) {
-            StringBuffer sb = new StringBuffer();
-            sb.append(getJavaModelPackage(table));
-            sb.append('.');
-            sb.append(table.getDomainObjectName());
-
-            fqjt = new FullyQualifiedJavaType(sb.toString());
-            map.put(key, fqjt);
-        }
-
-        return fqjt;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.ibatis.ibator.api.JavaModelGenerator#getRecordWithBLOBsType(org.apache.ibatis.ibator.config.FullyQualifiedTable)
-     */
-    public FullyQualifiedJavaType getRecordWithBLOBsType(
-            FullyQualifiedTable table) {
-        String key = "getRecordWithBLOBsType"; //$NON-NLS-1$
-
-        Map<String, Object> map = getTableValueMap(table);
-        FullyQualifiedJavaType fqjt = (FullyQualifiedJavaType) map.get(key);
-        if (fqjt == null) {
-            StringBuffer sb = new StringBuffer();
-            sb.append(getJavaModelPackage(table));
-            sb.append('.');
-            sb.append(table.getDomainObjectName());
-            sb.append("WithBLOBs"); //$NON-NLS-1$
-
-            fqjt = new FullyQualifiedJavaType(sb.toString());
-            map.put(key, fqjt);
-        }
-
-        return fqjt;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
      * @see org.apache.ibatis.ibator.api.JavaModelGenerator#setWarnings(java.util.List)
      */
     public void setWarnings(List<String> warnings) {
@@ -702,8 +545,8 @@
         
         CommentGenerator commentGenerator = ibatorContext.getCommentGenerator();
 
-        FullyQualifiedTable table = introspectedTable.getTable();
-        FullyQualifiedJavaType type = getExampleType(table);
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType type = introspectedTable.getExampleType();
         TopLevelClass topLevelClass = new TopLevelClass(type);
         topLevelClass.setVisibility(JavaVisibility.PUBLIC);
         commentGenerator.addJavaFileComment(topLevelClass);
@@ -840,7 +683,7 @@
 
         answer.setVisibility(JavaVisibility.PUBLIC);
         answer.setStatic(true);
-        ibatorContext.getCommentGenerator().addClassComment(answer, introspectedTable.getTable());
+        ibatorContext.getCommentGenerator().addClassComment(answer, introspectedTable.getFullyQualifiedTable());
 
         method = new Method();
         method.setVisibility(JavaVisibility.PROTECTED);

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/model/JavaModelGeneratorJava5Impl.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/model/JavaModelGeneratorJava5Impl.java?rev=663717&r1=663716&r2=663717&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/model/JavaModelGeneratorJava5Impl.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/model/JavaModelGeneratorJava5Impl.java Thu Jun  5 12:40:22 2008
@@ -56,8 +56,8 @@
         
         CommentGenerator commentGenerator = ibatorContext.getCommentGenerator();
 
-        FullyQualifiedTable table = introspectedTable.getTable();
-        FullyQualifiedJavaType type = getExampleType(table);
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType type = introspectedTable.getExampleType();
         TopLevelClass topLevelClass = new TopLevelClass(type);
         topLevelClass.setVisibility(JavaVisibility.PUBLIC);
         commentGenerator.addJavaFileComment(topLevelClass);
@@ -189,7 +189,7 @@
 
         answer.setVisibility(JavaVisibility.PUBLIC);
         answer.setStatic(true);
-        ibatorContext.getCommentGenerator().addClassComment(answer, introspectedTable.getTable());
+        ibatorContext.getCommentGenerator().addClassComment(answer, introspectedTable.getFullyQualifiedTable());
 
         method = new Method();
         method.setVisibility(JavaVisibility.PROTECTED);

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/ConditionalModelRules.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/ConditionalModelRules.java?rev=663717&r1=663716&r2=663717&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/ConditionalModelRules.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/ConditionalModelRules.java Thu Jun  5 12:40:22 2008
@@ -16,8 +16,8 @@
 
 package org.apache.ibatis.ibator.internal.rules;
 
+import org.apache.ibatis.ibator.api.IntrospectedTable;
 import org.apache.ibatis.ibator.config.TableConfiguration;
-import org.apache.ibatis.ibator.internal.db.ColumnDefinitions;
 
 /**
  * This class encapsulates all the code generation rules for 
@@ -34,8 +34,8 @@
      * 
      */
     public ConditionalModelRules(TableConfiguration tableConfiguration,
-            ColumnDefinitions columnDefinitions) {
-        super(tableConfiguration, columnDefinitions);
+            IntrospectedTable introspectedTable) {
+        super(tableConfiguration, introspectedTable);
     }
 
     /**
@@ -46,7 +46,7 @@
      */
     @Override
     public boolean generatePrimaryKeyClass() {
-        return columnDefinitions.getPrimaryKeyColumns().size() > 1;
+        return introspectedTable.getPrimaryKeyColumns().size() > 1;
     }
 
     /**
@@ -60,9 +60,9 @@
      */
     @Override
     public boolean generateBaseRecordClass() {
-        return columnDefinitions.getBaseColumns().size() > 0
-            || columnDefinitions.getPrimaryKeyColumns().size() == 1
-            || (columnDefinitions.getBLOBColumns().size() > 0
+        return introspectedTable.getBaseColumns().size() > 0
+            || introspectedTable.getPrimaryKeyColumns().size() == 1
+            || (introspectedTable.getBLOBColumns().size() > 0
                     && !generateRecordWithBLOBsClass());
         
     }
@@ -76,10 +76,10 @@
      */
     @Override
     public boolean generateRecordWithBLOBsClass() {
-        int otherColumnCount = columnDefinitions.getPrimaryKeyColumns().size()
-            + columnDefinitions.getBaseColumns().size();
+        int otherColumnCount = introspectedTable.getPrimaryKeyColumns().size()
+            + introspectedTable.getBaseColumns().size();
         
         return otherColumnCount > 1 
-            && columnDefinitions.getBLOBColumns().size() > 1;
+            && introspectedTable.getBLOBColumns().size() > 1;
     }
 }

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/FlatModelRules.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/FlatModelRules.java?rev=663717&r1=663716&r2=663717&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/FlatModelRules.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/FlatModelRules.java Thu Jun  5 12:40:22 2008
@@ -16,8 +16,8 @@
 
 package org.apache.ibatis.ibator.internal.rules;
 
+import org.apache.ibatis.ibator.api.IntrospectedTable;
 import org.apache.ibatis.ibator.config.TableConfiguration;
-import org.apache.ibatis.ibator.internal.db.ColumnDefinitions;
 
 /**
  * This class encapsulates all the code generation rules for 
@@ -32,8 +32,8 @@
      * 
      */
     public FlatModelRules(TableConfiguration tableConfiguration,
-            ColumnDefinitions columnDefinitions) {
-        super(tableConfiguration, columnDefinitions);
+            IntrospectedTable introspectedTable) {
+        super(tableConfiguration, introspectedTable);
     }
 
     /**

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/HierarchicalModelRules.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/HierarchicalModelRules.java?rev=663717&r1=663716&r2=663717&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/HierarchicalModelRules.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/HierarchicalModelRules.java Thu Jun  5 12:40:22 2008
@@ -16,8 +16,8 @@
 
 package org.apache.ibatis.ibator.internal.rules;
 
+import org.apache.ibatis.ibator.api.IntrospectedTable;
 import org.apache.ibatis.ibator.config.TableConfiguration;
-import org.apache.ibatis.ibator.internal.db.ColumnDefinitions;
 
 /**
  * This class encapsulates all the code generation rules for 
@@ -32,8 +32,8 @@
      * 
      */
     public HierarchicalModelRules(TableConfiguration tableConfiguration,
-            ColumnDefinitions columnDefinitions) {
-        super(tableConfiguration, columnDefinitions);
+            IntrospectedTable introspectedTable) {
+        super(tableConfiguration, introspectedTable);
     }
 
     /**
@@ -45,7 +45,7 @@
      */
     @Override
     public boolean generatePrimaryKeyClass() {
-        return columnDefinitions.hasPrimaryKeyColumns();
+        return introspectedTable.hasPrimaryKeyColumns();
     }
 
     /**
@@ -57,7 +57,7 @@
      */
     @Override
     public boolean generateBaseRecordClass() {
-        return columnDefinitions.hasBaseColumns();
+        return introspectedTable.hasBaseColumns();
     }
 
     /**
@@ -68,6 +68,6 @@
      */
     @Override
     public boolean generateRecordWithBLOBsClass() {
-        return columnDefinitions.hasBLOBColumns();
+        return introspectedTable.hasBLOBColumns();
     }
 }

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/IbatorRules.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/IbatorRules.java?rev=663717&r1=663716&r2=663717&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/IbatorRules.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/IbatorRules.java Thu Jun  5 12:40:22 2008
@@ -15,11 +15,9 @@
  */
 package org.apache.ibatis.ibator.internal.rules;
 
-import org.apache.ibatis.ibator.api.FullyQualifiedTable;
-import org.apache.ibatis.ibator.api.JavaModelGenerator;
+import org.apache.ibatis.ibator.api.IntrospectedTable;
 import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
 import org.apache.ibatis.ibator.config.TableConfiguration;
-import org.apache.ibatis.ibator.internal.db.ColumnDefinitions;
 
 /**
  * This class centralizes all the rules related to code generation - including
@@ -33,16 +31,16 @@
 public abstract class IbatorRules {
 
     protected TableConfiguration tableConfiguration;
-    protected ColumnDefinitions columnDefinitions;
+    protected IntrospectedTable introspectedTable;
 
     /**
      * 
      */
     public IbatorRules(TableConfiguration tableConfiguration,
-            ColumnDefinitions columnDefinitions) {
+            IntrospectedTable introspectedTable) {
         super();
         this.tableConfiguration = tableConfiguration;
-        this.columnDefinitions = columnDefinitions;
+        this.introspectedTable = introspectedTable;
     }
 
     /**
@@ -62,21 +60,18 @@
      * from the select by primary key method.  The actual class depends
      * on how the domain model is generated.
      * 
-     * @param javaModelGenerator
-     * @param table
      * @return the type of the class that holds all fields
      */
-    public FullyQualifiedJavaType calculateAllFieldsClass(JavaModelGenerator javaModelGenerator,
-            FullyQualifiedTable table) {
+    public FullyQualifiedJavaType calculateAllFieldsClass() {
         
         FullyQualifiedJavaType answer;
         
         if (generateRecordWithBLOBsClass()) {
-            answer = javaModelGenerator.getRecordWithBLOBsType(table);
+            answer = introspectedTable.getRecordWithBLOBsType();
         } else if (generateBaseRecordClass()) {
-            answer = javaModelGenerator.getBaseRecordType(table);
+            answer = introspectedTable.getBaseRecordType();
         } else {
-            answer = javaModelGenerator.getPrimaryKeyType(table);
+            answer = introspectedTable.getPrimaryKeyType();
         }
         
         return answer;
@@ -92,8 +87,8 @@
      */
     public boolean generateUpdateByPrimaryKeyWithoutBLOBs() {
         boolean rc = tableConfiguration.isUpdateByPrimaryKeyStatementEnabled()
-            && columnDefinitions.hasPrimaryKeyColumns()
-            && columnDefinitions.hasBaseColumns();
+            && introspectedTable.hasPrimaryKeyColumns()
+            && introspectedTable.hasBaseColumns();
         
         return rc;
     }
@@ -108,8 +103,8 @@
      */
     public boolean generateUpdateByPrimaryKeyWithBLOBs() {
         boolean rc = tableConfiguration.isUpdateByPrimaryKeyStatementEnabled()
-            && columnDefinitions.hasPrimaryKeyColumns()
-            && columnDefinitions.hasBLOBColumns();
+            && introspectedTable.hasPrimaryKeyColumns()
+            && introspectedTable.hasBLOBColumns();
     
         return rc;
     }
@@ -124,9 +119,9 @@
      */
     public boolean generateUpdateByPrimaryKeySelective() {
         boolean rc = tableConfiguration.isUpdateByPrimaryKeyStatementEnabled()
-            && columnDefinitions.hasPrimaryKeyColumns()
-            && (columnDefinitions.hasBLOBColumns()
-                    || columnDefinitions.hasBaseColumns());
+            && introspectedTable.hasPrimaryKeyColumns()
+            && (introspectedTable.hasBLOBColumns()
+                    || introspectedTable.hasBaseColumns());
     
         return rc;
     }
@@ -141,7 +136,7 @@
      */
     public boolean generateDeleteByPrimaryKey() {
         boolean rc = tableConfiguration.isDeleteByPrimaryKeyStatementEnabled()
-            && columnDefinitions.hasPrimaryKeyColumns();
+            && introspectedTable.hasPrimaryKeyColumns();
 
         return rc;
     }
@@ -182,7 +177,7 @@
     public boolean generateResultMapWithBLOBs() {
         boolean rc = (tableConfiguration.isSelectByExampleStatementEnabled()
             || tableConfiguration.isSelectByPrimaryKeyStatementEnabled())
-            && columnDefinitions.hasBLOBColumns();
+            && introspectedTable.hasBLOBColumns();
     
         return rc;
     }
@@ -212,9 +207,9 @@
      */
     public boolean generateSelectByPrimaryKey() {
         boolean rc = tableConfiguration.isSelectByPrimaryKeyStatementEnabled()
-            && columnDefinitions.hasPrimaryKeyColumns()
-            && (columnDefinitions.hasBaseColumns()
-                    || columnDefinitions.hasBLOBColumns());
+            && introspectedTable.hasPrimaryKeyColumns()
+            && (introspectedTable.hasBaseColumns()
+                    || introspectedTable.hasBLOBColumns());
         
         return rc;
     }
@@ -240,7 +235,7 @@
      */
     public boolean generateSelectByExampleWithBLOBs() {
         boolean rc = tableConfiguration.isSelectByExampleStatementEnabled()
-            && columnDefinitions.hasBLOBColumns();
+            && introspectedTable.hasBLOBColumns();
         
         return rc;
     }
@@ -275,15 +270,15 @@
 
     public boolean generateUpdateByExampleWithoutBLOBs() {
         boolean rc = tableConfiguration.isUpdateByExampleStatementEnabled()
-            && (columnDefinitions.hasPrimaryKeyColumns()
-            || columnDefinitions.hasBaseColumns());
+            && (introspectedTable.hasPrimaryKeyColumns()
+            || introspectedTable.hasBaseColumns());
         
         return rc;
     }
     
     public boolean generateUpdateByExampleWithBLOBs() {
         boolean rc = tableConfiguration.isUpdateByExampleStatementEnabled()
-            && columnDefinitions.hasBLOBColumns();
+            && introspectedTable.hasBLOBColumns();
     
         return rc;
     }

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/sqlmap/SqlMapGeneratorIterateImpl.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/sqlmap/SqlMapGeneratorIterateImpl.java?rev=663717&r1=663716&r2=663717&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/sqlmap/SqlMapGeneratorIterateImpl.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/sqlmap/SqlMapGeneratorIterateImpl.java Thu Jun  5 12:40:22 2008
@@ -16,17 +16,14 @@
 package org.apache.ibatis.ibator.internal.sqlmap;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.Properties;
 
 import org.apache.ibatis.ibator.api.FullyQualifiedTable;
 import org.apache.ibatis.ibator.api.GeneratedXmlFile;
 import org.apache.ibatis.ibator.api.IbatorPlugin;
 import org.apache.ibatis.ibator.api.IntrospectedTable;
-import org.apache.ibatis.ibator.api.JavaModelGenerator;
 import org.apache.ibatis.ibator.api.ProgressCallback;
 import org.apache.ibatis.ibator.api.SqlMapGenerator;
 import org.apache.ibatis.ibator.api.dom.OutputUtilities;
@@ -35,8 +32,8 @@
 import org.apache.ibatis.ibator.api.dom.xml.Document;
 import org.apache.ibatis.ibator.api.dom.xml.TextElement;
 import org.apache.ibatis.ibator.api.dom.xml.XmlElement;
-import org.apache.ibatis.ibator.config.IbatorContext;
 import org.apache.ibatis.ibator.config.GeneratedKey;
+import org.apache.ibatis.ibator.config.IbatorContext;
 import org.apache.ibatis.ibator.config.MergeConstants;
 import org.apache.ibatis.ibator.config.PropertyRegistry;
 import org.apache.ibatis.ibator.internal.db.ColumnDefinition;
@@ -58,71 +55,18 @@
     protected Properties properties;
 
     /**
-     * This is the target package from the SqlMap configuration element
-     */
-    protected String targetPackage;
-
-    /**
-     * This is the target project from the SqlMap configuration element
-     */
-    protected String targetProject;
-
-    /**
-     * This is the java model generator associated with the current generation
-     * context. Methods in this interface can be used to determine the
-     * appropriate result and parameter class names.
-     */
-    protected JavaModelGenerator javaModelGenerator;
-
-    /**
-     * This is a map of maps. The map is keyed by a FullyQualifiedTable object.
-     * The inner map holds generated strings keyed by the String name. This Map
-     * is used to cache generated Strings.
-     */
-    private Map<FullyQualifiedTable, Map<String, String>> tableStringMaps;
-
-    /**
      * Constructs an instance of SqlMapGeneratorDefaultImpl
      */
     public SqlMapGeneratorIterateImpl() {
         super();
-        tableStringMaps = new HashMap<FullyQualifiedTable, Map<String, String>>();
         properties = new Properties();
     }
 
-    private Map<String, String> getTableStringMap(FullyQualifiedTable table) {
-        Map<String, String> map = tableStringMaps.get(table);
-        if (map == null) {
-            map = new HashMap<String, String>();
-            tableStringMaps.put(table, map);
-        }
-
-        return map;
-    }
-
     public void addConfigurationProperties(Properties properties) {
         this.properties.putAll(properties);
     }
 
     /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.ibatis.ibator.api.SqlMapGenerator#setTargetPackage(java.lang.String)
-     */
-    public void setTargetPackage(String targetPackage) {
-        this.targetPackage = targetPackage;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.ibatis.ibator.api.SqlMapGenerator#setJavaModelGenerator(org.apache.ibatis.ibator.api.JavaModelGenerator)
-     */
-    public void setJavaModelGenerator(JavaModelGenerator javaModelGenerator) {
-        this.javaModelGenerator = javaModelGenerator;
-    }
-
-    /*
      *  (non-Javadoc)
      * @see org.apache.ibatis.ibator.api.SqlMapGenerator#getGeneratedXMLFiles(org.apache.ibatis.ibator.api.IntrospectedTable, org.apache.ibatis.ibator.api.ProgressCallback)
      */
@@ -130,15 +74,17 @@
             ProgressCallback callback) {
         List<GeneratedXmlFile> list = new ArrayList<GeneratedXmlFile>();
 
-        FullyQualifiedTable table = introspectedTable.getTable();
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
         callback.startSubTask(Messages.getString(
                 "Progress.12", //$NON-NLS-1$
                 table.toString()));
         Document document = getSqlMap(introspectedTable);
         if (document != null) {
             GeneratedXmlFile gxf = new GeneratedXmlFile(document,
-                    getSqlMapFileName(table), getSqlMapPackage(table),
-                    targetProject, true);
+                    introspectedTable.getSqlMapFileName(),
+                    introspectedTable.getSqlMapPackage(),
+                    ibatorContext.getSqlMapGeneratorConfiguration().getTargetProject(),
+                    true);
             if (ibatorContext.getPlugins().sqlMapGenerated(gxf, introspectedTable)) {
                 list.add(gxf);
             }
@@ -176,7 +122,7 @@
      */
     protected XmlElement getSqlMapElement(IntrospectedTable introspectedTable) {
 
-        FullyQualifiedTable table = introspectedTable.getTable();
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
         XmlElement answer = new XmlElement("sqlMap"); //$NON-NLS-1$
         answer.addAttribute(new Attribute("namespace", //$NON-NLS-1$
                 table.getSqlMapNamespace()));
@@ -344,15 +290,14 @@
         boolean useColumnIndex =
             "true".equalsIgnoreCase(introspectedTable.getTableConfigurationProperty(PropertyRegistry.TABLE_USE_COLUMN_INDEXES)); //$NON-NLS-1$
         XmlElement answer = new XmlElement("resultMap"); //$NON-NLS-1$
-        FullyQualifiedTable table = introspectedTable.getTable();
         answer.addAttribute(new Attribute("id", //$NON-NLS-1$
-                getResultMapName(table)));
+                XmlConstants.BASE_RESULT_MAP_ID));
 
         FullyQualifiedJavaType returnType;
         if (introspectedTable.getRules().generateBaseRecordClass()) {
-            returnType = javaModelGenerator.getBaseRecordType(table);
+            returnType = introspectedTable.getBaseRecordType();
         } else {
-            returnType = javaModelGenerator.getPrimaryKeyType(table);
+            returnType = introspectedTable.getPrimaryKeyType();
         }
         
         answer.addAttribute(new Attribute("class", //$NON-NLS-1$
@@ -406,30 +351,27 @@
             "true".equalsIgnoreCase(introspectedTable.getTableConfigurationProperty(PropertyRegistry.TABLE_USE_COLUMN_INDEXES)); //$NON-NLS-1$
 
         XmlElement answer = new XmlElement("resultMap"); //$NON-NLS-1$
-        FullyQualifiedTable table = introspectedTable.getTable();
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
 
-        StringBuffer sb = new StringBuffer();
-        sb.append(getResultMapName(table));
-        sb.append("WithBLOBs"); //$NON-NLS-1$
-
-        answer.addAttribute(new Attribute("id", sb.toString())); //$NON-NLS-1$
+        answer.addAttribute(new Attribute("id", 
+                XmlConstants.RESULT_MAP_WITH_BLOBS_ID)); //$NON-NLS-1$
         
         FullyQualifiedJavaType returnType;
         if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
-            returnType = javaModelGenerator.getRecordWithBLOBsType(table);
+            returnType = introspectedTable.getRecordWithBLOBsType();
         } else {
             // table has BLOBs, but no BLOB class - BLOB fields must be
             // in the base class
-            returnType = javaModelGenerator.getBaseRecordType(table);
+            returnType = introspectedTable.getBaseRecordType();
         }
         
         answer.addAttribute(new Attribute("class", //$NON-NLS-1$
                 returnType.getFullyQualifiedName()));
 
-        sb.setLength(0);
+        StringBuffer sb = new StringBuffer();
         sb.append(table.getSqlMapNamespace());
         sb.append('.');
-        sb.append(getResultMapName(table));
+        sb.append(XmlConstants.BASE_RESULT_MAP_ID);
         answer.addAttribute(new Attribute("extends", sb.toString())); //$NON-NLS-1$
 
         ibatorContext.getCommentGenerator().addComment(answer);
@@ -476,11 +418,11 @@
         
         XmlElement answer = new XmlElement("insert"); //$NON-NLS-1$
 
-        FullyQualifiedTable table = introspectedTable.getTable();
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
         answer.addAttribute(new Attribute("id", XmlConstants.INSERT_STATEMENT_ID)); //$NON-NLS-1$
         
         FullyQualifiedJavaType parameterType =
-            introspectedTable.getRules().calculateAllFieldsClass(javaModelGenerator, table);
+            introspectedTable.getRules().calculateAllFieldsClass();
         
         answer.addAttribute(new Attribute("parameterClass", //$NON-NLS-1$
                 parameterType.getFullyQualifiedName()));
@@ -554,7 +496,7 @@
     protected XmlElement getUpdateByPrimaryKeyWithBLOBs(IntrospectedTable introspectedTable) {
 
         XmlElement answer = new XmlElement("update"); //$NON-NLS-1$
-        FullyQualifiedTable table = introspectedTable.getTable();
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
 
         answer.addAttribute(new Attribute(
                 "id", XmlConstants.UPDATE_BY_PRIMARY_KEY_WITH_BLOBS_STATEMENT_ID)); //$NON-NLS-1$
@@ -562,9 +504,9 @@
         FullyQualifiedJavaType parameterType;
         
         if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
-            parameterType = javaModelGenerator.getRecordWithBLOBsType(table);
+            parameterType = introspectedTable.getRecordWithBLOBsType();
         } else {
-            parameterType = javaModelGenerator.getBaseRecordType(table);
+            parameterType = introspectedTable.getBaseRecordType();
         }
         
         answer.addAttribute(new Attribute("parameterClass", //$NON-NLS-1$
@@ -632,12 +574,12 @@
     protected XmlElement getUpdateByPrimaryKeyWithoutBLOBs(IntrospectedTable introspectedTable) {
 
         XmlElement answer = new XmlElement("update"); //$NON-NLS-1$
-        FullyQualifiedTable table = introspectedTable.getTable();
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
 
         answer.addAttribute(new Attribute(
                 "id", XmlConstants.UPDATE_BY_PRIMARY_KEY_STATEMENT_ID)); //$NON-NLS-1$
         answer.addAttribute(new Attribute("parameterClass", //$NON-NLS-1$
-                javaModelGenerator.getBaseRecordType(table).getFullyQualifiedName()));
+                introspectedTable.getBaseRecordType().getFullyQualifiedName()));
 
         ibatorContext.getCommentGenerator().addComment(answer);
 
@@ -700,15 +642,15 @@
     protected XmlElement getDeleteByPrimaryKey(IntrospectedTable introspectedTable) {
 
         XmlElement answer = new XmlElement("delete"); //$NON-NLS-1$
-        FullyQualifiedTable table = introspectedTable.getTable();
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
 
         answer.addAttribute(new Attribute(
                 "id", XmlConstants.DELETE_BY_PRIMARY_KEY_STATEMENT_ID)); //$NON-NLS-1$
         FullyQualifiedJavaType parameterClass;
         if (introspectedTable.getRules().generatePrimaryKeyClass()) {
-            parameterClass = javaModelGenerator.getPrimaryKeyType(table);
+            parameterClass = introspectedTable.getPrimaryKeyType();
         } else {
-            parameterClass = javaModelGenerator.getBaseRecordType(table);
+            parameterClass = introspectedTable.getBaseRecordType();
         }
         answer.addAttribute(new Attribute("parameterClass", //$NON-NLS-1$
                 parameterClass.getFullyQualifiedName()));
@@ -750,8 +692,8 @@
 
         XmlElement answer = new XmlElement("delete"); //$NON-NLS-1$
 
-        FullyQualifiedTable table = introspectedTable.getTable();
-        FullyQualifiedJavaType fqjt = javaModelGenerator.getExampleType(table);
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType fqjt = introspectedTable.getExampleType();
 
         answer
                 .addAttribute(new Attribute(
@@ -790,8 +732,8 @@
 
         XmlElement answer = new XmlElement("select"); //$NON-NLS-1$
 
-        FullyQualifiedTable table = introspectedTable.getTable();
-        FullyQualifiedJavaType fqjt = javaModelGenerator.getExampleType(table);
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType fqjt = introspectedTable.getExampleType();
 
         answer
                 .addAttribute(new Attribute(
@@ -832,25 +774,25 @@
     protected XmlElement getSelectByPrimaryKey(IntrospectedTable introspectedTable) {
 
         XmlElement answer = new XmlElement("select"); //$NON-NLS-1$
-        FullyQualifiedTable table = introspectedTable.getTable();
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
 
         answer.addAttribute(new Attribute(
                 "id", XmlConstants.SELECT_BY_PRIMARY_KEY_STATEMENT_ID)); //$NON-NLS-1$
         if (introspectedTable.getRules().generateResultMapWithBLOBs()) {
             answer.addAttribute(new Attribute("resultMap", //$NON-NLS-1$
-                    getResultMapName(table) + "WithBLOBs")); //$NON-NLS-1$
+                    XmlConstants.RESULT_MAP_WITH_BLOBS_ID));
         } else {
             answer.addAttribute(new Attribute("resultMap", //$NON-NLS-1$
-                    getResultMapName(table)));
+                    XmlConstants.BASE_RESULT_MAP_ID));
         }
         
         FullyQualifiedJavaType parameterType;
         if (introspectedTable.getRules().generatePrimaryKeyClass()) {
-            parameterType = javaModelGenerator.getPrimaryKeyType(table);
+            parameterType = introspectedTable.getPrimaryKeyType();
         } else {
             // select by primary key, but no primary key class.  Fields
             // must be in the base record
-            parameterType = javaModelGenerator.getBaseRecordType(table);
+            parameterType = introspectedTable.getBaseRecordType();
         }
         
         answer.addAttribute(new Attribute("parameterClass", //$NON-NLS-1$
@@ -933,90 +875,6 @@
     }
 
     /**
-     * Calculates the name of the result map. Typically this is the String
-     * "prefix_XXXXResult" where XXXX is the name of the domain object
-     * related to this table. The prefix is important because
-     * it allows ibator to regenerate this element on subsequent runs.
-     * 
-     * @param table
-     *            the current table
-     * @return the name of the result map
-     */
-    protected String getResultMapName(FullyQualifiedTable table) {
-        String key = "getResultMapName"; //$NON-NLS-1$
-        String s;
-
-        Map<String, String> map = getTableStringMap(table);
-        s = map.get(key);
-        if (s == null) {
-            StringBuffer sb = new StringBuffer();
-
-            sb.append(MergeConstants.NEW_XML_ELEMENT_PREFIX);
-            sb.append(table.getDomainObjectName());
-            sb.append("Result"); //$NON-NLS-1$
-
-            s = sb.toString();
-            map.put(key, s);
-        }
-
-        return s;
-    }
-
-    /**
-     * Calculates a file name for the current table. Typically the name is
-     * "XXXX_SqlMap.xml" where XXXX is the fully qualified table name (delimited
-     * with underscores).
-     * 
-     * @param table
-     *            the current table
-     * @return tha name of the SqlMap file
-     */
-    protected String getSqlMapFileName(FullyQualifiedTable table) {
-        String key = "getSqlMapFileName"; //$NON-NLS-1$
-        String s;
-
-        Map<String, String> map = getTableStringMap(table);
-        s = map.get(key);
-        if (s == null) {
-            StringBuffer sb = new StringBuffer();
-            sb.append(table.getSqlMapNamespace());
-
-            sb.append("_SqlMap.xml"); //$NON-NLS-1$
-
-            s = sb.toString();
-            map.put(key, s);
-        }
-
-        return s;
-    }
-
-    /**
-     * Calculates the package for the current table.
-     * 
-     * @param table
-     *            the current table
-     * @return the package for the SqlMap for the current table
-     */
-    protected String getSqlMapPackage(FullyQualifiedTable table) {
-        String key = "getSqlMapPackage"; //$NON-NLS-1$
-        String s;
-
-        Map<String, String> map = getTableStringMap(table);
-        s = map.get(key);
-        if (s == null) {
-            StringBuffer sb = new StringBuffer(targetPackage);
-            if ("true".equalsIgnoreCase(properties.getProperty(PropertyRegistry.ANY_ENABLE_SUB_PACKAGES))) { //$NON-NLS-1$
-                sb.append(table.getSubPackage());
-            }
-            
-            s = sb.toString();
-            map.put(key, s);
-        }
-
-        return s;
-    }
-
-    /**
      * Calculates the name of the example where clause element.
      * 
      * @return the name of the example where clause element
@@ -1235,8 +1093,8 @@
      * @return the select element
      */
     protected XmlElement getSelectByExample(IntrospectedTable introspectedTable) {
-        FullyQualifiedTable table = introspectedTable.getTable();
-        FullyQualifiedJavaType fqjt = javaModelGenerator.getExampleType(table);
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType fqjt = introspectedTable.getExampleType();
 
         XmlElement answer = new XmlElement("select"); //$NON-NLS-1$
 
@@ -1244,7 +1102,7 @@
                 XmlConstants.SELECT_BY_EXAMPLE_STATEMENT_ID));
         answer
                 .addAttribute(new Attribute(
-                        "resultMap", getResultMapName(table))); //$NON-NLS-1$
+                        "resultMap", XmlConstants.BASE_RESULT_MAP_ID)); //$NON-NLS-1$
         answer.addAttribute(new Attribute(
                 "parameterClass", fqjt.getFullyQualifiedName())); //$NON-NLS-1$
 
@@ -1305,14 +1163,14 @@
      */
     protected XmlElement getSelectByExampleWithBLOBs(IntrospectedTable introspectedTable) {
 
-        FullyQualifiedTable table = introspectedTable.getTable();
-        FullyQualifiedJavaType fqjt = javaModelGenerator.getExampleType(table);
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        FullyQualifiedJavaType fqjt = introspectedTable.getExampleType();
 
         XmlElement answer = new XmlElement("select"); //$NON-NLS-1$
         answer.addAttribute(new Attribute(
                 "id", XmlConstants.SELECT_BY_EXAMPLE_WITH_BLOBS_STATEMENT_ID)); //$NON-NLS-1$
         answer.addAttribute(new Attribute(
-                "resultMap", getResultMapName(table) + "WithBLOBs")); //$NON-NLS-1$ //$NON-NLS-2$
+                "resultMap", XmlConstants.RESULT_MAP_WITH_BLOBS_ID)); //$NON-NLS-1$
         answer.addAttribute(new Attribute(
                 "parameterClass", fqjt.getFullyQualifiedName())); //$NON-NLS-1$
 
@@ -1368,15 +1226,6 @@
     /*
      * (non-Javadoc)
      * 
-     * @see org.apache.ibatis.ibator.api.SqlMapGenerator#setTargetProject(java.lang.String)
-     */
-    public void setTargetProject(String targetProject) {
-        this.targetProject = targetProject;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
      * @see org.apache.ibatis.ibator.api.SqlMapGenerator#setWarnings(java.util.List)
      */
     public void setWarnings(List<String> warnings) {
@@ -1394,7 +1243,7 @@
     protected XmlElement getUpdateByPrimaryKeySelective(IntrospectedTable introspectedTable) {
 
         XmlElement answer = new XmlElement("update"); //$NON-NLS-1$
-        FullyQualifiedTable table = introspectedTable.getTable();
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
 
         answer.addAttribute(new Attribute(
                 "id", XmlConstants.UPDATE_BY_PRIMARY_KEY_SELECTIVE_STATEMENT_ID)); //$NON-NLS-1$
@@ -1402,9 +1251,9 @@
         FullyQualifiedJavaType parameterType;
         
         if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
-            parameterType = javaModelGenerator.getRecordWithBLOBsType(table);
+            parameterType = introspectedTable.getRecordWithBLOBsType();
         } else {
-            parameterType = javaModelGenerator.getBaseRecordType(table);
+            parameterType = introspectedTable.getBaseRecordType();
         }
         
         answer.addAttribute(new Attribute("parameterClass", //$NON-NLS-1$
@@ -1470,7 +1319,7 @@
     protected XmlElement getUpdateByExampleSelective(IntrospectedTable introspectedTable) {
         
         XmlElement answer = new XmlElement("update"); //$NON-NLS-1$
-        FullyQualifiedTable table = introspectedTable.getTable();
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
 
         answer.addAttribute(new Attribute(
                 "id", XmlConstants.UPDATE_BY_EXAMPLE_SELECTIVE_STATEMENT_ID)); //$NON-NLS-1$
@@ -1515,7 +1364,7 @@
 
     protected XmlElement getUpdateByExampleWithBLOBs(IntrospectedTable introspectedTable) {
         XmlElement answer = new XmlElement("update"); //$NON-NLS-1$
-        FullyQualifiedTable table = introspectedTable.getTable();
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
 
         answer.addAttribute(new Attribute(
                 "id", XmlConstants.UPDATE_BY_EXAMPLE_WITH_BLOBS_STATEMENT_ID)); //$NON-NLS-1$
@@ -1566,7 +1415,7 @@
 
     protected XmlElement getUpdateByExampleWithoutBLOBs(IntrospectedTable introspectedTable) {
         XmlElement answer = new XmlElement("update"); //$NON-NLS-1$
-        FullyQualifiedTable table = introspectedTable.getTable();
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
 
         answer.addAttribute(new Attribute(
                 "id", XmlConstants.UPDATE_BY_EXAMPLE_STATEMENT_ID)); //$NON-NLS-1$

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/sqlmap/XmlConstants.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/sqlmap/XmlConstants.java?rev=663717&r1=663716&r2=663717&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/sqlmap/XmlConstants.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/sqlmap/XmlConstants.java Thu Jun  5 12:40:22 2008
@@ -95,6 +95,16 @@
         sb.append(MergeConstants.NEW_XML_ELEMENT_PREFIX);
         sb.append("updateByPrimaryKeyWithBLOBs"); //$NON-NLS-1$
         UPDATE_BY_PRIMARY_KEY_WITH_BLOBS_STATEMENT_ID = sb.toString();
+
+        sb.setLength(0);
+        sb.append(MergeConstants.NEW_XML_ELEMENT_PREFIX);
+        sb.append("BaseResultMap"); //$NON-NLS-1$
+        BASE_RESULT_MAP_ID = sb.toString();
+
+        sb.setLength(0);
+        sb.append(MergeConstants.NEW_XML_ELEMENT_PREFIX);
+        sb.append("ResultMapWithBLOBs"); //$NON-NLS-1$
+        RESULT_MAP_WITH_BLOBS_ID = sb.toString();
     }
 
     public static final String SQL_MAP_SYSTEM_ID = "http://ibatis.apache.org/dtd/sql-map-2.dtd"; //$NON-NLS-1$
@@ -134,4 +144,8 @@
     public static final String UPDATE_BY_PRIMARY_KEY_SELECTIVE_STATEMENT_ID;
 
     public static final String UPDATE_BY_PRIMARY_KEY_WITH_BLOBS_STATEMENT_ID;
+
+    public static final String BASE_RESULT_MAP_ID;
+
+    public static final String RESULT_MAP_WITH_BLOBS_ID;
 }

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/EqualsHashCodePlugin.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/EqualsHashCodePlugin.java?rev=663717&r1=663716&r2=663717&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/EqualsHashCodePlugin.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/EqualsHashCodePlugin.java Thu Jun  5 12:40:22 2008
@@ -135,7 +135,7 @@
         }
 
         ibatorContext.getCommentGenerator().addGeneralMethodComment(method,
-                introspectedTable.getTable());
+                introspectedTable.getFullyQualifiedTable());
 
         method.addBodyLine("if (this == that) {"); //$NON-NLS-1$
         method.addBodyLine("return true;"); //$NON-NLS-1$
@@ -226,7 +226,7 @@
         }
 
         ibatorContext.getCommentGenerator().addGeneralMethodComment(method,
-                introspectedTable.getTable());
+                introspectedTable.getFullyQualifiedTable());
 
         method.addBodyLine("int hash = 23;"); //$NON-NLS-1$
 

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/SerializablePlugin.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/SerializablePlugin.java?rev=663717&r1=663716&r2=663717&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/SerializablePlugin.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/SerializablePlugin.java Thu Jun  5 12:40:22 2008
@@ -55,19 +55,19 @@
 
     @Override
     public boolean modelBaseRecordClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
-        makeSerializable(topLevelClass, introspectedTable.getTable());
+        makeSerializable(topLevelClass, introspectedTable.getFullyQualifiedTable());
         return true;
     }
 
     @Override
     public boolean modelPrimaryKeyClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
-        makeSerializable(topLevelClass, introspectedTable.getTable());
+        makeSerializable(topLevelClass, introspectedTable.getFullyQualifiedTable());
         return true;
     }
 
     @Override
     public boolean modelRecordWithBLOBsClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
-        makeSerializable(topLevelClass, introspectedTable.getTable());
+        makeSerializable(topLevelClass, introspectedTable.getFullyQualifiedTable());
         return true;
     }
     

Modified: ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/execute/miscellaneous/BaseClass.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/execute/miscellaneous/BaseClass.java?rev=663717&r1=663716&r2=663717&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/execute/miscellaneous/BaseClass.java (original)
+++ ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/execute/miscellaneous/BaseClass.java Thu Jun  5 12:40:22 2008
@@ -35,7 +35,7 @@
     public final String getLastname() {
         return lastname;
     }
-
+    
     public final void setLastname(String lastname) {
         this.lastname = lastname;
     }

Modified: ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/execute/miscellaneous/FirstName.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/execute/miscellaneous/FirstName.java?rev=663717&r1=663716&r2=663717&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/execute/miscellaneous/FirstName.java (original)
+++ ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/execute/miscellaneous/FirstName.java Thu Jun  5 12:40:22 2008
@@ -13,7 +13,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package ibatortest.execute.miscellaneous;
 
 /**

Modified: ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/execute/miscellaneous/MiscellaneousTests.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/execute/miscellaneous/MiscellaneousTests.java?rev=663717&r1=663716&r2=663717&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/execute/miscellaneous/MiscellaneousTests.java (original)
+++ ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/execute/miscellaneous/MiscellaneousTests.java Thu Jun  5 12:40:22 2008
@@ -615,20 +615,27 @@
             example.createCriteria().andId2In(ids);
 
             example.setOrderByClause("ID1, ID2");
-            List answer = dao.selectMyObjectByExample(example);
+            List<MyObject> answer = dao.selectMyObjectByExample(example);
             assertEquals(4, answer.size());
-            MyObject returnedRecord = (MyObject) answer.get(0);
+            MyObject returnedRecord = answer.get(0);
             assertEquals(1, returnedRecord.getId1().intValue());
             assertEquals(1, returnedRecord.getId2().intValue());
-            returnedRecord = (MyObject) answer.get(1);
+            assertEquals("Flintstone", returnedRecord.getLastname());
+            
+            returnedRecord = answer.get(1);
             assertEquals(1, returnedRecord.getId1().intValue());
             assertEquals(3, returnedRecord.getId2().intValue());
-            returnedRecord = (MyObject) answer.get(2);
+            assertEquals("Flintstone", returnedRecord.getLastname());
+            
+            returnedRecord = answer.get(2);
             assertEquals(2, returnedRecord.getId1().intValue());
             assertEquals(1, returnedRecord.getId2().intValue());
-            returnedRecord = (MyObject) answer.get(3);
+            assertEquals("Rubble", returnedRecord.getLastname());
+            
+            returnedRecord = answer.get(3);
             assertEquals(2, returnedRecord.getId1().intValue());
             assertEquals(3, returnedRecord.getId2().intValue());
+            assertEquals("Rubble", returnedRecord.getLastname());
         } catch (SQLException e) {
             fail(e.getMessage());
         }