Author: jgbutler Date: Mon Jan 28 10:29:09 2008 New Revision: 615979 URL: http://svn.apache.org/viewvc?rev=615979&view=rev Log: Abator: many documentation updates
Modified: ibatis/trunk/java/mapper/mapper2/tools/abator/core/doc/ReleaseNotes.txt ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/afterRunning.html ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/configreference/generatedKey.html ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/configreference/xmlconfig.html ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/generatedobjects/sqlmap.html ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/intro.html ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/quickstart.html ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/roadmap.html ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/running.html ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/whatsNew.html ibatis/trunk/java/mapper/mapper2/tools/abator/core/src/org/apache/ibatis/abator/internal/db/DatabaseDialects.java ibatis/trunk/java/mapper/mapper2/tools/abator/core/src/org/apache/ibatis/abator/internal/java/model/JavaModelGeneratorJava2Impl.java ibatis/trunk/java/mapper/mapper2/tools/abator/core/src/org/apache/ibatis/abator/internal/java/model/JavaModelGeneratorJava5Impl.java Modified: ibatis/trunk/java/mapper/mapper2/tools/abator/core/doc/ReleaseNotes.txt URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/tools/abator/core/doc/ReleaseNotes.txt?rev=615979&r1=615978&r2=615979&view=diff ============================================================================== --- ibatis/trunk/java/mapper/mapper2/tools/abator/core/doc/ReleaseNotes.txt (original) +++ ibatis/trunk/java/mapper/mapper2/tools/abator/core/doc/ReleaseNotes.txt Mon Jan 28 10:29:09 2008 @@ -8,6 +8,8 @@ 4. Fixed the configuration parser so that it correctly deals with external entities 5. IBATIS-434 - Incorrect default mapping for BIT datatype +6. Fixed bug where Abator generated incorrect properties for certain + database columns (for example, if the column name is I_NAME) Enhancements - 1. IBATIS-348 - escape column names with $ or #, and ignore special characters @@ -40,6 +42,7 @@ 15. Java2 is now the default generator set 16. IBATIS-470 - make legacy DAOs extendable 17. IBATIS-468 - add <columnRenamingRule> +18. Added DB2 Main Frame database dialect for generated keys ------------------------------------------------------------------------------- Version 1.0.0: Modified: ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/afterRunning.html URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/afterRunning.html?rev=615979&r1=615978&r2=615979&view=diff ============================================================================== --- ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/afterRunning.html (original) +++ ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/afterRunning.html Mon Jan 28 10:29:09 2008 @@ -62,7 +62,7 @@ </sqlMapConfig> </pre> -<p>If there are more than one SQL Map XML files (as is quite common), +<p>If there is more than one SQL Map XML file (as is quite common), then the files can be listed in any order with repeated <code><sqlMap></code> elements after the <code><transactionManager></code> element.</p> Modified: ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/configreference/generatedKey.html URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/configreference/generatedKey.html?rev=615979&r1=615978&r2=615979&view=diff ============================================================================== --- ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/configreference/generatedKey.html (original) +++ ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/configreference/generatedKey.html Mon Jan 28 10:29:09 2008 @@ -34,31 +34,37 @@ <table> <tr> <th>Cloudscape</th> - <td>This will translate to <code>VALUES IDENTITY_VAL_LOCAL()</code></td> + <td>This will translate to: <code>VALUES IDENTITY_VAL_LOCAL()</code></td> </tr> <tr> <th>DB2</th> - <td>This will translate to <code>VALUES IDENTITY_VAL_LOCAL()</code></td> + <td>This will translate to: <code>VALUES IDENTITY_VAL_LOCAL()</code></td> + </tr> + <tr> + <th valign="top">DB2_MF</th> + <td>This will translate to: <br/> <code>SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1</code> + <p>Use this value for DB2 on zOS (Main Frames) and, in some cases, iSeries (AS/400)</p> + </td> </tr> <tr> <th>Derby</th> - <td>This will translate to <code>VALUES IDENTITY_VAL_LOCAL()</code></td> + <td>This will translate to: <code>VALUES IDENTITY_VAL_LOCAL()</code></td> </tr> <tr> <th>HSQLDB</th> - <td>This will translate to <code>CALL IDENTITY()</code></td> + <td>This will translate to: <code>CALL IDENTITY()</code></td> </tr> <tr> <th>MySql</th> - <td>This will translate to <code>SELECT LAST_INSERT_ID()</code></td> + <td>This will translate to: <code>SELECT LAST_INSERT_ID()</code></td> </tr> <tr> <th>SqlServer</th> - <td>This will translate to <code>SELECT SCOPE_IDENTITY()</code></td> + <td>This will translate to: <code>SELECT SCOPE_IDENTITY()</code></td> </tr> <tr> <th>SYBASE</th> - <td>This will translate to <code>SELECT @@IDENTITY</code></td> + <td>This will translate to: <code>SELECT @@IDENTITY</code></td> </tr> </table> </td> Modified: ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/configreference/xmlconfig.html URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/configreference/xmlconfig.html?rev=615979&r1=615978&r2=615979&view=diff ============================================================================== --- ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/configreference/xmlconfig.html (original) +++ ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/configreference/xmlconfig.html Mon Jan 28 10:29:09 2008 @@ -9,7 +9,7 @@ </head> <body> <h1>XML Configuration File Reference</h1> -<p>In the normal use case, Abator is driven by an XML configuration file. +<p>In the most common use case, Abator is driven by an XML configuration file. The configuration file tells Abator:</p> <ul> Modified: ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/generatedobjects/sqlmap.html URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/generatedobjects/sqlmap.html?rev=615979&r1=615978&r2=615979&view=diff ============================================================================== --- ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/generatedobjects/sqlmap.html (original) +++ ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/generatedobjects/sqlmap.html Mon Jan 28 10:29:09 2008 @@ -77,12 +77,16 @@ This implements a simple "query by example" functionality that can be used to generate many different database queries. The returned rows will not include any BLOB fields that exist in the table (see the select by example with BLOBs statement below).</p> +<p><b>Important:</b> If the example class is null, or no criteria have been set, +then <b>all</b> rows in the table will be selected.</p> <p>This element will be generated if the select by example statement is enabled.</p> <h2>Select by Example With BLOBs</h2> <p>This element contains a select statement with rows that match the example object. This implements a simple "query by example" functionality that can be used to generate many different database queries. The returned rows will include any BLOB fields that exist in the table.</p> +<p><b>Important:</b> If the example class is null, or no criteria have been set, +then <b>all</b> rows in the table will be selected.</p> <p>This element will be generated if the table contains BLOB fields, and the select by example statement is enabled.</p> @@ -134,6 +138,49 @@ <h2>Delete By Example</h2> <p>This element is a delete statement that will delete one or more rows in the table - designated by the example object.</p> +<p><b>Important:</b> If the example class is null, or no criteria have been set, +then <b>all</b> rows in the table will be deleted.</p> <p>This element will be generated if the delete by example statement is enabled.</p> + +<h2>Count By Example</h2> +<p>This element is a select count(*) statement that will return the number of rows in the table +that match the specified example object.</p> +<p><b>Important:</b> If the example class is null, or no criteria have been set, +then the select will return the number of rows in the entire table.</p> +<p>This element will be generated if the count by example statement is enabled.</p> + +<h2>Update By Example</h2> +<p>This element is an update statement that will update all rows in a table that match +the specified example. The update statement will update all fields in the table unless:</p> +<ul> + <li>The field has been ignored by the <code><ignoreColumn></code> configuration element</li> + <li>The field is a BLOB field (see the update by example with BLOBs element)</li> +</ul> +<p><b>Important:</b> If the example class is null, or no criteria have been set, +then <b>all</b> rows in the table will be updated.</p> +<p>This element will be generated if the update by example statement is enabled.</p> + +<h2>Update By Example With BLOBs</h2> +<p>This element is an update statement that will update all rows in a table that match +the specified example. The update statement will update all fields in the table (including BLOB fields) +unless:</p> +<ul> + <li>The field has been ignored by the <code><ignoreColumn></code> configuration element</li> +</ul> +<p><b>Important:</b> If the example class is null, or no criteria have been set, +then <b>all</b> rows in the table will be updated.</p> +<p>This element will be generated if the table contains BLOB columns, and the update by +example statement is enabled.</p> + +<h2>Update By Example Selective</h2> +<p>This element is an update statement that will update all rows in a table that match the +specified example. The update statement will update only the fields in the table whose corresponding +property in the parameter object is non-null. This statement can be used to update +certain columns in certain records without affecting all columns in the records. <b>Important:</b> +if the column has been mapped to a primitive type, then the column will always be +updated.</p> +<p><b>Important:</b> If the example class is null, or no criteria have been set, +then <b>all</b> rows in the table will be updated.</p> +<p>This element will be generated if the update by example statement is enabled.</p> </body> </html> Modified: ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/intro.html URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/intro.html?rev=615979&r1=615978&r2=615979&view=diff ============================================================================== --- ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/intro.html (original) +++ ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/intro.html Mon Jan 28 10:29:09 2008 @@ -28,12 +28,12 @@ <li>a class to match the primary key of the table (if there is a primary key)</li> <li>a class to match the non-primary key fields of the table (except BLOB fields)</li> <li>a class to include the BLOB fields of a table (if the table has BLOB fields)</li> - <li>a class to enable "Query By Example" functionality</li> + <li>a class to enable dynamic selects, updates, and deletes</li> </ul> <p>There is an inheritance relationship between these classes as appropriate. - Abator may be configured to generate different types of POJO hierarchies - - you may choose to tell - Abator to only generate a single domain object for each table if you so + Note that Abator may be configured to generate different types of POJO hierarchies - + for example, you may choose to tell + Abator to generate a single domain object for each table if you so desire.</p> </li> <li>iBATIS Compatible SQL Map XML Files. Abator generates SQL for simple @@ -42,6 +42,7 @@ <ul> <li>insert</li> <li>update by primary key</li> + <li>update by example (using a dynamic where clause)</li> <li>delete by primary key</li> <li>delete by example (using a dynamic where clause)</li> <li>select by primary key</li> @@ -49,7 +50,7 @@ </ul> <p>There are different variations of these statements depending on the structure of the table (for example, if the table doesn't have a primary key, - then Abator will not generate an update by primary key function, etc.)</p> + then Abator will not generate an update by primary key function).</p> </li> <li>DAO interface and implementation classes that make appropriate use of the above objects. The generation of DAO classes is optional. Abator will @@ -78,7 +79,7 @@ You can run it over and over again without fear of losing custom changes to you XML. Abator will replace any XML elements that were generated in a previous run. </li> - <li>Abator will not merge Java files, it can either overwrite existing files + <li>Abator will <b>not</b> merge Java files, it can either overwrite existing files or save newly generated files with a different unique name. If you make changes to the generated Java files and run Abator iteratively you will have to merge the changes by hand. When run as an @@ -94,7 +95,7 @@ <h2>Support</h2> <p>Support for Abator is provided through the iBATIS user mailing list. -You can subscribe to the mailing list by sending a note to:</p> +You may subscribe to the mailing list by sending a note to:</p> <blockquote> <p> @@ -118,7 +119,7 @@ <p>If you think you have found a bug, please ask a question about it on the user list first, before creating a JIRA issue. If you find a bug, or have a new feature request, -you can open a JIRA issue for Abator at</p> +you may open a JIRA issue for Abator at</p> <blockquote> <p> @@ -128,7 +129,7 @@ </p> </blockquote> -<p>Please select the "Tools" component when creating any issues for Abator.</p> +<p>Please select the "Tools" component when creating any JIRA issues for Abator.</p> </body> </html> Modified: ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/quickstart.html URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/quickstart.html?rev=615979&r1=615978&r2=615979&view=diff ============================================================================== --- ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/quickstart.html (original) +++ ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/quickstart.html Mon Jan 28 10:29:09 2008 @@ -21,7 +21,7 @@ <li>A <code><sqlMapGenerator></code> element to specify target package and target project for generated SQL map files</li> <li>(Optionally) A <code><daoGenerator></code> element to specify target package - and target project for generated DAO interfaces and classes (you can + and target project for generated DAO interfaces and classes (you may omit the <code><daoGenerator></code> element if you don't wish to generate DAOs)</li> <li>At least one database <code><table></code> element</li> </ol> @@ -32,11 +32,11 @@ <li>Run Abator from the command line with a command like this: <pre> - java -jar abator.jar \temp\abatorConfig.xml true + java -jar abator.jar -configfile \temp\abatorConfig.xml -overwrite </pre> <p>This will tell Abator to run using your configuration file. It will also tell Abator to overwrite any existing Java files with the same name. If you want to save any existing - Java files, specify "false" for the second parameter. If there is a conflict, Abator + Java files, then omit the <code>-overwrite</code> parameter. If there is a conflict, Abator will save the newly generated file with a unique name (e.g. MyClass.java.1).</p> </li> <li>After running Abator, you will need to create or modify the standard iBATIS Modified: ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/roadmap.html URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/roadmap.html?rev=615979&r1=615978&r2=615979&view=diff ============================================================================== --- ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/roadmap.html (original) +++ ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/roadmap.html Mon Jan 28 10:29:09 2008 @@ -9,9 +9,8 @@ </head> <body> <h1>Abator Roadmap</h1> -<p>The following are enhancements that we would like to make to Abator:</p> +<p>The following are enhancements that are under consideration for future versions of Abator:</p> <ul> - <li>Update By Example Method</li> <li>Generate objects from arbitrary queries</li> <li>Generate nested objects and specialized queries that utilize the iBATIS groupBy function</li> Modified: ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/running.html URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/running.html?rev=615979&r1=615978&r2=615979&view=diff ============================================================================== --- ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/running.html (original) +++ ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/running.html Mon Jan 28 10:29:09 2008 @@ -16,11 +16,13 @@ <li>From another Java program with an XML configuration</li> <li>From another Java program with a Java based configuration</li> </ul> -<p>Each method is described in detail below. Note that there is also an Eclipse +<p>Each method is described in detail below.</p> +<p><b>Note:</b> there is also an Eclipse plugin for Abator that adds extra function - namely good integration into Eclipse, an Eclipse enabled Ant task, and support for automatic merging of -Java files. See the Abator home page for information on installing the -Eclipse plugin.</p> +Java files. See the +<a target="_blank" href="http://ibatis.apache.org/abator.html">Abator</a> +home page for information on installing the Eclipse plugin.</p> <p><b>Important:</b> When running outside of an IDE environment like Eclipse, Abator interprets the <code>targetProject</code> and @@ -34,9 +36,9 @@ </ul> <h2>Running Abator from the Command Line</h2> -<p>Abator can be run directly from the command line. The JAR manifest includes the +<p>Abator may be run directly from the command line. The JAR manifest includes the name of the default class (<code>org.apache.ibatis.abator.api.AbatorRunner</code>) - or you can specify it yourself. The <code>AbatorRunner</code> + or you may specify it yourself. The <code>AbatorRunner</code> class accepts several arguments as detailed below:</p> <table border="1" cellspacing="0" cellpadding="5"> <tr> @@ -81,7 +83,8 @@ </tr> </table> -<p>You must still create an Abator XML configuration file. If the file is +<p>You must create an Abator XML configuration file to run Abator from the + command line. If the file is named "abatorConfig.xml", then any of the following command lines will run Abator:</p> <pre> @@ -163,8 +166,8 @@ <p>Notes:</p> <ul> - <li>The classpath on the <taskdef> is used to tell Ant where the implementing - code is. This is optional if you add Abator to the Ant classpath in one + <li>The classpath on the <taskdef> is used to tell Ant where the Abator JAR file + is. This is optional if you add Abator to the Ant classpath in one of the other ways described in the Ant manual</li> <li>The name of the task can be anything you desire, "abator" is simply an example</li> Modified: ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/whatsNew.html URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/whatsNew.html?rev=615979&r1=615978&r2=615979&view=diff ============================================================================== --- ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/whatsNew.html (original) +++ ibatis/trunk/java/mapper/mapper2/tools/abator/core/htmldoc/whatsNew.html Mon Jan 28 10:29:09 2008 @@ -15,19 +15,30 @@ <dl> <dt><b>countByExample</b></dt> <dd>This method will return an integer representing the number of rows in a table - that match the given example.</dd> + that match the given criteria.</dd> <dt><b>updateByExample</b></dt> - <dd>This method will update all rows in a table that match a given example. This method is + <dd>This method will update all rows in a table that match a given criteria. This method is available in the Java2 and Java5 generator sets only. There is also a "selective" version - of the method that only updates certain columns of a table.</dd> + of the method that only updates certain columns of a table (the selective version of this + method is probably the more useful version to use in most situations).</dd> </dl> +<h3>Bugs Fixed</h3> +<ul> + <li>Fixed bug for corner case where a criteria class is created, but no criteria + are set.</li> + <li>Fixed a bug that caused the JavaModelGenerator's "trimStrings" property to fail</li> + <li>Fixed the XML file merger so that internal entities are preserved</li> + <li>Fixed the XML configuration parser so that external entities are handled properly</li> + <li>Fixed bug - incorrect datatype mapping for JDBC BIT datatype</li> + <li>Fixed bug where Abator generated incorrect properties for certain database columns + (for example, if the column name is I_NAME)</li> +</ul> + <h3>Miscellaneous Changes</h3> <ul> <li>Java2 is now the default generator set. <b>The Legacy generator set will be removed in the next release of Abator.</b></li> - <li>Fixed a bug that caused the JavaModelGenerator's "trimStrings" property to fail</li> - <li>Fixed the XML file merger so that internal entities are preserved</li> <li>Added the ability to specify properties to ignore qualifiers and change runtime table names in the generated SQL for a table. Primary use cases for this support include: @@ -48,6 +59,9 @@ <li>Added SYBASE dialect for generated keys. See the <a href="configreference/generatedKey.html"><generatedKey></a> reference page for more information.</li> + <li>Added DB2_MF (DB2 on Main Frames) dialect for generated keys. + See the <a href="configreference/generatedKey.html"><generatedKey></a> + reference page for more information.</li> <li>Abator will now automatically escape identifiers that contain the $ or # characters as these characters have special meaning in iBATIS configuration files.</li> <li>Added a <code>clear</code> method to the generated example classes (in the Java2 and Java5 @@ -63,14 +77,25 @@ </ul> See the <a href="configreference/table.html"><table></a> reference page for more information.</li> - <li>Fixed bug - incorrect datatype mapping for JDBC BIT datatype</li> <li>Made the generated Example and Criteria classes extendable</li> <li>Made the legacy DAOs extendable</li> - <li>Added the ability to provide a renaming rule for columns. This is for the + <li>Added the ability to provide a renaming rule for columns. This is for the use case where columns have a common prefix that should be removed before calculating the property name. See the <a href="configreference/columnRenamingRule.html"><columnRenamingRule></a> reference page for more information</li> + <li>Added support for persisting a configuration to XML - this to enable + a graphical editor in the future</li> + <li>Add afterXXXGenerationHook() methods in all generators to enable adding + extra Java code or XML elements to any generated object. This will make + it easier to create customized generators.</li> + <li>API change to allow generating with selected contexts rather than + the entire config file.</li> + <li>API change to allow generating with selected tables rather than + the entire config file.</li> + <li>Exposed new support for selecting tables and/or contexts to the + command line and the Ant task - this has added an advanced syntax to the command + line for Abator.</li> </ul> <h2>Version 1.0.0</h2> Modified: ibatis/trunk/java/mapper/mapper2/tools/abator/core/src/org/apache/ibatis/abator/internal/db/DatabaseDialects.java URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/tools/abator/core/src/org/apache/ibatis/abator/internal/db/DatabaseDialects.java?rev=615979&r1=615978&r2=615979&view=diff ============================================================================== --- ibatis/trunk/java/mapper/mapper2/tools/abator/core/src/org/apache/ibatis/abator/internal/db/DatabaseDialects.java (original) +++ ibatis/trunk/java/mapper/mapper2/tools/abator/core/src/org/apache/ibatis/abator/internal/db/DatabaseDialects.java Mon Jan 28 10:29:09 2008 @@ -36,6 +36,8 @@ public static final DatabaseDialects SYBASE = new DatabaseDialects("SELECT @@IDENTITY"); //$NON-NLS-1$ + public static final DatabaseDialects DB2_MF = new DatabaseDialects("SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1"); //$NON-NLS-1$ + private String identityRetrievalStatement; /** @@ -73,6 +75,8 @@ returnValue = HSQLDB; } else if ("SYBASE".equalsIgnoreCase(database)) { //$NON-NLS-1$ returnValue = SYBASE; + } else if ("DB2_MF".equalsIgnoreCase(database)) { //$NON-NLS-1$ + returnValue = DB2_MF; } return returnValue; Modified: ibatis/trunk/java/mapper/mapper2/tools/abator/core/src/org/apache/ibatis/abator/internal/java/model/JavaModelGeneratorJava2Impl.java URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/tools/abator/core/src/org/apache/ibatis/abator/internal/java/model/JavaModelGeneratorJava2Impl.java?rev=615979&r1=615978&r2=615979&view=diff ============================================================================== --- ibatis/trunk/java/mapper/mapper2/tools/abator/core/src/org/apache/ibatis/abator/internal/java/model/JavaModelGeneratorJava2Impl.java (original) +++ ibatis/trunk/java/mapper/mapper2/tools/abator/core/src/org/apache/ibatis/abator/internal/java/model/JavaModelGeneratorJava2Impl.java Mon Jan 28 10:29:09 2008 @@ -805,10 +805,19 @@ } method.setName("createCriteria"); //$NON-NLS-1$ method.setReturnType(FullyQualifiedJavaType.getCriteriaInstance()); - method.addBodyLine("Criteria criteria = new Criteria();"); //$NON-NLS-1$ + method.addBodyLine("Criteria criteria = createCriteriaInternal();"); //$NON-NLS-1$ method.addBodyLine("if (oredCriteria.size() == 0) {"); //$NON-NLS-1$ method.addBodyLine("oredCriteria.add(criteria);"); //$NON-NLS-1$ method.addBodyLine("}"); //$NON-NLS-1$ + method.addBodyLine("return criteria;"); //$NON-NLS-1$ + topLevelClass.addMethod(method); + + method = new Method(); + method.addComment(table); + method.setVisibility(JavaVisibility.PROTECTED); + method.setName("createCriteriaInternal"); //$NON-NLS-1$ + method.setReturnType(FullyQualifiedJavaType.getCriteriaInstance()); + method.addBodyLine("Criteria criteria = new Criteria();"); //$NON-NLS-1$ method.addBodyLine("return criteria;"); //$NON-NLS-1$ topLevelClass.addMethod(method); Modified: ibatis/trunk/java/mapper/mapper2/tools/abator/core/src/org/apache/ibatis/abator/internal/java/model/JavaModelGeneratorJava5Impl.java URL: http://svn.apache.org/viewvc/ibatis/trunk/java/mapper/mapper2/tools/abator/core/src/org/apache/ibatis/abator/internal/java/model/JavaModelGeneratorJava5Impl.java?rev=615979&r1=615978&r2=615979&view=diff ============================================================================== --- ibatis/trunk/java/mapper/mapper2/tools/abator/core/src/org/apache/ibatis/abator/internal/java/model/JavaModelGeneratorJava5Impl.java (original) +++ ibatis/trunk/java/mapper/mapper2/tools/abator/core/src/org/apache/ibatis/abator/internal/java/model/JavaModelGeneratorJava5Impl.java Mon Jan 28 10:29:09 2008 @@ -145,13 +145,22 @@ method.setVisibility(JavaVisibility.PUBLIC); method.setName("createCriteria"); //$NON-NLS-1$ method.setReturnType(FullyQualifiedJavaType.getCriteriaInstance()); - method.addBodyLine("Criteria criteria = new Criteria();"); //$NON-NLS-1$ + method.addBodyLine("Criteria criteria = createCriteriaInternal();"); //$NON-NLS-1$ method.addBodyLine("if (oredCriteria.size() == 0) {"); //$NON-NLS-1$ method.addBodyLine("oredCriteria.add(criteria);"); //$NON-NLS-1$ method.addBodyLine("}"); //$NON-NLS-1$ method.addBodyLine("return criteria;"); //$NON-NLS-1$ topLevelClass.addMethod(method); + method = new Method(); + method.addComment(table); + method.setVisibility(JavaVisibility.PROTECTED); + method.setName("createCriteriaInternal"); //$NON-NLS-1$ + method.setReturnType(FullyQualifiedJavaType.getCriteriaInstance()); + method.addBodyLine("Criteria criteria = new Criteria();"); //$NON-NLS-1$ + method.addBodyLine("return criteria;"); //$NON-NLS-1$ + topLevelClass.addMethod(method); + method = new Method(); method.addComment(table); method.setVisibility(JavaVisibility.PUBLIC);