Index: C:/Workspace/ibator/core/src/org/apache/ibatis/ibator/config/PropertyRegistry.java =================================================================== --- C:/Workspace/ibator/core/src/org/apache/ibatis/ibator/config/PropertyRegistry.java (revision 654658) +++ C:/Workspace/ibator/core/src/org/apache/ibatis/ibator/config/PropertyRegistry.java (working copy) @@ -44,7 +44,8 @@ public static final String TABLE_RUNTIME_CATALOG = "runtimeCatalog"; //$NON-NLS-1$ public static final String TABLE_RUNTIME_SCHEMA = "runtimeSchema"; //$NON-NLS-1$ public static final String TABLE_RUNTIME_TABLE_NAME = "runtimeTableName"; //$NON-NLS-1$ - + public static final String SUBPACKAGE_NAME = "subPackage"; //$NON-NLS-1$ + public static final String CONTEXT_SUPPRESS_TYPE_WARNINGS = "suppressTypeWarnings"; //$NON-NLS-1$ public static final String CONTEXT_BEGINNING_DELIMITER = "beginningDelimiter"; //$NON-NLS-1$ public static final String CONTEXT_ENDING_DELIMITER = "endingDelimiter"; //$NON-NLS-1$ Index: C:/Workspace/ibator/core/src/org/apache/ibatis/ibator/api/FullyQualifiedTable.java =================================================================== --- C:/Workspace/ibator/core/src/org/apache/ibatis/ibator/api/FullyQualifiedTable.java (revision 654658) +++ C:/Workspace/ibator/core/src/org/apache/ibatis/ibator/api/FullyQualifiedTable.java (working copy) @@ -38,6 +38,8 @@ private String runtimeTableName; + private String subPackage; + private String domainObjectName; private String alias; @@ -92,6 +94,10 @@ * the actual table name and schema for generation, but would want to * use the synonym name in the generated SQL * + * @param subPackage this is used to define the final fragment in the + * Java package for a given table. This is used when the user wants + * to separate tables into different packages. + * * @param delimitIdentifiers if true, then the table identifiers will be * delimited at runtime. The delimiter characters are obtained * from the IbatorContext. @@ -105,6 +111,7 @@ String runtimeCatalog, String runtimeSchema, String runtimeTableName, + String subPackage boolean delimitIdentifiers, IbatorContext ibatorContext) { super(); @@ -116,6 +123,7 @@ this.runtimeCatalog = runtimeCatalog; this.runtimeSchema = runtimeSchema; this.runtimeTableName = runtimeTableName; + this.subPackage = subPackage; if (alias == null) { this.alias = null; @@ -262,7 +270,8 @@ /** * Calculates a Java package fragment based on the - * table catalog and schema. If qualifiers are ignored, + * table catalog and schema. If a subPackage is set, + * it will be returned. If qualifiers are ignored, * then this method will return an empty string * * @return the subpackage for this table @@ -270,21 +279,27 @@ public String getSubPackage() { StringBuffer sb = new StringBuffer(); if (!ignoreQualifiersAtRuntime) { - if (StringUtility.stringHasValue(runtimeCatalog)) { - sb.append('.'); - sb.append(runtimeCatalog.toLowerCase()); - } else if (StringUtility.stringHasValue(introspectedCatalog)) { - sb.append('.'); - sb.append(introspectedCatalog.toLowerCase()); - } - - if (StringUtility.stringHasValue(runtimeSchema)) { - sb.append('.'); - sb.append(runtimeSchema.toLowerCase()); - } else if (StringUtility.stringHasValue(introspectedSchema)) { - sb.append('.'); - sb.append(introspectedSchema.toLowerCase()); - } + if (StringUtility.stringHasValue(subPackage)) { + sb.append('.'); + sb.append(subPackage.toLowerCase()); + } + else { + if (StringUtility.stringHasValue(runtimeCatalog)) { + sb.append('.'); + sb.append(runtimeCatalog.toLowerCase()); + } else if (StringUtility.stringHasValue(introspectedCatalog)) { + sb.append('.'); + sb.append(introspectedCatalog.toLowerCase()); + } + + if (StringUtility.stringHasValue(runtimeSchema)) { + sb.append('.'); + sb.append(runtimeSchema.toLowerCase()); + } else if (StringUtility.stringHasValue(introspectedSchema)) { + sb.append('.'); + sb.append(introspectedSchema.toLowerCase()); + } + } } // TODO - strip characters that are not valid in pacckage names Index: C:/Workspace/ibator/core/src/org/apache/ibatis/ibator/internal/db/DatabaseIntrospector.java =================================================================== --- C:/Workspace/ibator/core/src/org/apache/ibatis/ibator/internal/db/DatabaseIntrospector.java (revision 654658) +++ C:/Workspace/ibator/core/src/org/apache/ibatis/ibator/internal/db/DatabaseIntrospector.java (working copy) @@ -455,6 +455,7 @@ tc.getProperty(PropertyRegistry.TABLE_RUNTIME_CATALOG), tc.getProperty(PropertyRegistry.TABLE_RUNTIME_SCHEMA), tc.getProperty(PropertyRegistry.TABLE_RUNTIME_TABLE_NAME), + tc.getProperty(PropertyRegistry.SUBPACKAGE_NAME), delimitIdentifiers, ibatorContext);