Return-Path: Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: (qmail 67002 invoked from network); 5 Nov 2006 12:59:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Nov 2006 12:59:04 -0000 Received: (qmail 33825 invoked by uid 500); 5 Nov 2006 12:59:15 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 33702 invoked by uid 500); 5 Nov 2006 12:59:15 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 33691 invoked by uid 500); 5 Nov 2006 12:59:15 -0000 Received: (qmail 33688 invoked by uid 99); 5 Nov 2006 12:59:15 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Nov 2006 04:59:15 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Nov 2006 04:59:02 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 78A431A9846; Sun, 5 Nov 2006 04:58:36 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r471417 - in /db/torque: generator/trunk/src/java/org/apache/torque/engine/database/model/ generator/trunk/xdocs/ site/trunk/xdocs/ site/trunk/xdocs/version-specific/other-howtos/ templates/trunk/src/templates/om/ Date: Sun, 05 Nov 2006 12:58:36 -0000 To: torque-commits@db.apache.org From: tfischer@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061105125836.78A431A9846@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tfischer Date: Sun Nov 5 04:58:35 2006 New Revision: 471417 URL: http://svn.apache.org/viewvc?view=rev&rev=471417 Log: Applied Greg's patch which - adds a generator setting where uppercase column names can be generated. - allows columns to have the name DATRABASE_NAME or TABLE_NAME Fixes TORQUE-44. Modified: db/torque/generator/trunk/src/java/org/apache/torque/engine/database/model/Column.java db/torque/generator/trunk/xdocs/properties-reference.xml db/torque/site/trunk/xdocs/changes.xml db/torque/site/trunk/xdocs/version-specific/other-howtos/database-layout-howto.xml db/torque/templates/trunk/src/templates/om/MapBuilder.vm db/torque/templates/trunk/src/templates/om/Object.vm db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm db/torque/templates/trunk/src/templates/om/Peer.vm Modified: db/torque/generator/trunk/src/java/org/apache/torque/engine/database/model/Column.java URL: http://svn.apache.org/viewvc/db/torque/generator/trunk/src/java/org/apache/torque/engine/database/model/Column.java?view=diff&rev=471417&r1=471416&r2=471417 ============================================================================== --- db/torque/generator/trunk/src/java/org/apache/torque/engine/database/model/Column.java (original) +++ db/torque/generator/trunk/src/java/org/apache/torque/engine/database/model/Column.java Sun Nov 5 04:58:35 2006 @@ -309,9 +309,32 @@ { return StringUtils.uncapitalize(getJavaName()); } + + /** + * Returns the name of the constant that is used for the column in the Peer + * class, e.g., RecordPeer.COLVARNAME. + * Generally this will be a straight conversion to upper case. + * But if the column name is equals to TABLE_NAME or + * DATABASE_NAME (Torque predefined vars), the column name will have an _ + * prefixed, e.g. _TABLE_NAME. + *

+ * TODO: Handle delimited column names that have non-Java identifier + * characters in them. + * + * @return The name to use in defining the Peer class column variable. + */ + public String getPeerJavaName() + { + String peerName = name.toUpperCase(); + if ( peerName.equals("TABLE_NAME") || + peerName.equals("DATABASE_NAME")) { + peerName = "_" + peerName; + } + return peerName; + } /** - * Set name to use in Java sources + * Set the name to use in Java sources. */ public void setJavaName(String javaName) { @@ -750,30 +773,30 @@ * If size attribute is an integer number, it will be returned. * If size attribute is of the format "Precision,Scale", then Precision * will be returned. - * If size is null or the size value is not an valid integer, + * If size is null or the size value is not an valid integer, * null is returned. *

* Note: Unparseable values will be logged as a warning. - * - * @return The precision portion of the size attribute. + * + * @return The precision portion of the size attribute. */ public String getPrecision() { String size = getSize(); - if (size == null) + if ( size == null ) { return size; } int cLoc = size.indexOf(','); - if (cLoc > 0) + if ( cLoc > 0 ) { size = size.substring(0, cLoc); } - try + try { Integer.parseInt(size); - } - catch (NumberFormatException e) + } + catch ( NumberFormatException e ) { log.warn("getPrecision(): Size attribute found (" + getSize() @@ -784,43 +807,43 @@ } /** - * Try to determine the scale of the field from the scale and size + * Try to determine the scale of the field from the scale and size * attribute. * If scale attribute is an integer number, it will be returned. * If size attribute is of the format "Precision,Scale", then Scale * will be returned. - * If scale and size attributes are null or the scale value found + * If scale and size attributes are null or the scale value found * is not an valid integer, a null value is returned. *

* Note: Unparseable values will be logged as a warning. - * - * @return The precision portion of the size attribute. + * + * @return The precision portion of the size attribute. */ public String getScale() { String scale = domain.getScale(); // Check for scale on size attribute if no scale attribute - if (scale == null) + if ( scale == null ) { scale = getSize(); - if (scale == null) // No scale or size attribute set. + if ( scale == null ) // No scale or size attribute set. { return scale; } int cLoc = scale.indexOf(','); - if (cLoc < 0) // Size did not have "P,S" format + if ( cLoc < 0 ) // Size did not have "P,S" format { return null; } - scale = scale.substring(cLoc + 1); + scale = scale.substring(cLoc + 1 ); } // Validate that scale string found is integer. - try + try { Integer.parseInt(scale); } - catch (NumberFormatException e) + catch ( NumberFormatException e ) { log.warn("getScale(): Scale (or size=\"p,s\") attribute found (" + scale @@ -1179,29 +1202,29 @@ /** * Get the value of the inheritance attribute defined in the schema XML. - * + * * @return Returns the inheritanceType. */ public String getInheritanceType() { return inheritanceType; } - + /** * Add an XML Specified option key/value pair to this element's option set. - * + * * @param key the key of the option. * @param value the value of the option. */ public void addOption(String key, String value) { - options.put(key, value); + options.put( key, value ); } - + /** - * Get the value that was associated with this key in an XML option + * Get the value that was associated with this key in an XML option * element. - * + * * @param key the key of the option. * @return The value for the key or a null. */ @@ -1209,18 +1232,18 @@ { return (String) options.get(key); } - + /** * Gets the full ordered hashtable array of items specified by XML option * statements under this element.

- * - * Note, this is not thread save but since it's only used for - * generation which is single threaded, there should be minimum + * + * Note, this is not thread save but since it's only used for + * generation which is single threaded, there should be minimum * danger using this in Velocity. - * + * * @return An Map of all options. Will not be null but may be empty. */ - public Map getOptions() + public Map getOptions() { return options; } Modified: db/torque/generator/trunk/xdocs/properties-reference.xml URL: http://svn.apache.org/viewvc/db/torque/generator/trunk/xdocs/properties-reference.xml?view=diff&rev=471417&r1=471416&r2=471417 ============================================================================== --- db/torque/generator/trunk/xdocs/properties-reference.xml (original) +++ db/torque/generator/trunk/xdocs/properties-reference.xml Sun Nov 5 04:58:35 2006 @@ -415,6 +415,16 @@ in generated code. + + torque.deprecated.uppercasePeer + false + + If true, the values of the Peer column variables, e.g. + RecordPeer.COLUMN_A, will use an all upper case column name. + This was the original way that Torque generated these values but is + being deprecated in favor or using the exact XML name value. + + Modified: db/torque/site/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewvc/db/torque/site/trunk/xdocs/changes.xml?view=diff&rev=471417&r1=471416&r2=471417 ============================================================================== --- db/torque/site/trunk/xdocs/changes.xml (original) +++ db/torque/site/trunk/xdocs/changes.xml Sun Nov 5 04:58:35 2006 @@ -28,8 +28,11 @@ + + The Column names TABLE_NAME and DATABASE_NAME are now legal column names. + - Added maven 2 plugin. + Added a maven 2 plugin. Fixed handling of escaping (by backslashes) for LIKE clauses. @@ -69,18 +72,20 @@ The default package for generated classes was changed from - org.apache.torque to torque.generated. + org.apache.torque to torque.generated. - - Selects for BOOLEANCHAR and BOOLEANINT now works for aliased tablenames + + Selects for BOOLEANCHAR and BOOLEANINT now work for aliased tablenames and joined tables. - + Preserved case when generating the constants for column names in the Peers and the database maps. For example, for a table named book and a column namend author_id, the constant BaseBookPeer.AUTHOR_ID is now set to book.author_id, whereas in former versions, this constant - would have been set to book.AUTHOR_ID. + would have been set to book.AUTHOR_ID.
+ The old behaviour can be regained by setting the generator property + torque.deprecated.uppercasePeer to true.
Simplified the Torque Avalon component. @@ -654,7 +659,7 @@ Make the getter names for the table column values configurable. Torque did generate non-Bean-Spec compliant getter names for boolean columns (get<xxx> instead of is<xxx>). - By setting torque.correctGetters to true, this can be changed. This is a + By setting torque.correctGetters to true, this can be changed. This is a generator-only change, the resulting peers still run with the 3.1.1 runtime. @@ -666,8 +671,8 @@ - Change PostgreSQL ID generation to use select nextval - instead of select currval. + Change PostgreSQL ID generation to use select nextval + instead of select currval. Generated code contains Javadoc error "sentence is different...". @@ -686,7 +691,7 @@ will not help much anyway and if you really insist on building an object that differs from an existing object only by the contents of a binary column (which implies that such a column might be a primary key), then you deserve to suffer. Don't do this. - For everyone else, this change might actually make doDelete(object) work if your + For everyone else, this change might actually make doDelete(object) work if your object contains a binary column. @@ -698,7 +703,7 @@ Add Torque Reporting to the Maven plugin. Patch contributed by Thierry Lach. - Make org.apache.torque.util.SqlEnum public visible. The C'tor is + Make org.apache.torque.util.SqlEnum public visible. The C'tor is still private, so this should be no problem. @@ -731,15 +736,15 @@ file. Activated the maven-changes-report. - Changed the default property value for torque.output.dir - from maven.build.dest to maven.build.dir. + Changed the default property value for torque.output.dir + from maven.build.dest to maven.build.dir. This means many of the generated files will now appear in the - target rather than the target/classes + target rather than the target/classes directory. The properties reference was updated accordingly (a few missing properties were also documented). - Add missing method retrieveByPK(native type, Connection) + Add missing method retrieveByPK(native type, Connection) method to the generated peer classes @@ -777,8 +782,8 @@ - limit and offset handling for all databases - other than DB2 was broken. limit and offset + limit and offset handling for all databases + other than DB2 was broken. limit and offset handling for all databases has been revamped and should now work correctly. Modified: db/torque/site/trunk/xdocs/version-specific/other-howtos/database-layout-howto.xml URL: http://svn.apache.org/viewvc/db/torque/site/trunk/xdocs/version-specific/other-howtos/database-layout-howto.xml?view=diff&rev=471417&r1=471416&r2=471417 ============================================================================== --- db/torque/site/trunk/xdocs/version-specific/other-howtos/database-layout-howto.xml (original) +++ db/torque/site/trunk/xdocs/version-specific/other-howtos/database-layout-howto.xml Sun Nov 5 04:58:35 2006 @@ -40,13 +40,39 @@

There are some column names which you can not use in Torque although - your database would support them. The reason is that they would - produce constants twice in the generated code. The column names which - cannot be used are (case is ignored) + your database would support them. These are any column name that contains + characters that are not in Java's variable identifier character set. + The reason is that column names are used as variable names in the OM Peer + classes and these columns will cause the Torque generated code to not + compile. +

+ +

+ Note however, that SQL92 standard and up uses the same identifier + characters as Java for non-delimited columns. So this should only apply + to columns defined by the SQL standard as delimited columns, i.e. + columns referred to surrounded by double quotes. Delimited column + are considered to be case sensitive and/or contain non-standard + characters. However, most good cross DB server designs should avoid + these special types of column since some servers don't support delimited + columns. +

+ +

+ In addition, there are two column names that are handled slighly + differently in the OM Peer classes. This is so they will not produce + constants twice in the generated code. The following column names (case is + ignored) will have an "_" prefixed in front of them in the Peer + classes:

    -
  • TABLE_NAME
  • -
  • DATABASE_NAME
  • +
  • TABLE_NAME => _TABLE_NAME
  • +
  • DATABASE_NAME => _DATABASE_NAME
+

+ +

+ Note that prior to Release 3.2.1, using these two column names WILL produce + duplicate constants and uncompilable code.

Modified: db/torque/templates/trunk/src/templates/om/MapBuilder.vm URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/MapBuilder.vm?view=diff&rev=471417&r1=471416&r2=471417 ============================================================================== --- db/torque/templates/trunk/src/templates/om/MapBuilder.vm (original) +++ db/torque/templates/trunk/src/templates/om/MapBuilder.vm Sun Nov 5 04:58:35 2006 @@ -125,9 +125,11 @@ #foreach ($col in $table.Columns) #set ( $cfc=$col.JavaName ) - #set ( $cup=$col.Name.toUpperCase() ) #set ( $cnm=$col.Name ) - // ------------- Column: $cup -------------------- + #if ( ! ${deprecatedUppercasePeer} ) + #set ( $cnm=$col.Name.toUpperCase() ) + #end + // ------------- Column: $cnm -------------------- cMap = new ColumnMap( "$cnm", tMap); cMap.setType( $col.JavaObject ); cMap.setTorqueType( "$col.Domain.Type.Name" ); Modified: db/torque/templates/trunk/src/templates/om/Object.vm URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/Object.vm?view=diff&rev=471417&r1=471416&r2=471417 ============================================================================== --- db/torque/templates/trunk/src/templates/om/Object.vm (original) +++ db/torque/templates/trunk/src/templates/om/Object.vm Sun Nov 5 04:58:35 2006 @@ -684,7 +684,7 @@ #set ( $column = $table.getColumn($columnName) ) #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) ) #set ( $colFK = $tblFK.getColumn($colFKName) ) - criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}() ); + criteria.add(${className}Peer.${colFK.PeerJavaName}, ${column.GetterName}() ); #end $collName = ${className}Peer.doSelect(criteria); } @@ -702,7 +702,7 @@ #set ( $column = $table.getColumn($columnName) ) #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) ) #set ( $colFK = $tblFK.getColumn($colFKName) ) - criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}()); + criteria.add(${className}Peer.${colFK.PeerJavaName}, ${column.GetterName}()); #end #if ($objectIsCaching) if (!last${relCol}Criteria.equals(criteria)) @@ -776,7 +776,7 @@ #set ( $column = $table.getColumn($columnName) ) #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) ) #set ( $colFK = $tblFK.getColumn($colFKName) ) - criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}()); + criteria.add(${className}Peer.${colFK.PeerJavaName}, ${column.GetterName}()); #end $collName = ${className}Peer.doSelect(criteria, con); } @@ -794,7 +794,7 @@ #set ( $column = $table.getColumn($columnName) ) #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) ) #set ( $colFK = $tblFK.getColumn($colFKName) ) - criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}()); + criteria.add(${className}Peer.${colFK.PeerJavaName}, ${column.GetterName}()); #end #if ($objectIsCaching) if (!last${relCol}Criteria.equals(criteria)) @@ -904,7 +904,7 @@ #set ( $column = $table.getColumn($columnName) ) #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) ) #set ( $colFK = $tblFK.getColumn($colFKName) ) - criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}()); + criteria.add(${className}Peer.${colFK.PeerJavaName}, ${column.GetterName}()); #end $collName = ${className}Peer.doSelectJoin${relCol2}(criteria); } @@ -919,7 +919,7 @@ #set ( $column = $table.getColumn($columnName) ) #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) ) #set ( $colFK = $tblFK.getColumn($colFKName) ) - criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}()); + criteria.add(${className}Peer.${colFK.PeerJavaName}, ${column.GetterName}()); #end #if ($objectIsCaching) if (!last${relCol}Criteria.equals(criteria)) @@ -974,7 +974,7 @@ #set ( $column = $table.getColumn($columnName) ) #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) ) #set ( $colFK = $tblFK.getColumn($colFKName) ) - criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}()); + criteria.add(${className}Peer.${colFK.PeerJavaName}, ${column.GetterName}()); #end $collName = ${className}Peer.doSelectJoinAllExcept${table.JavaName}${suffix}(criteria); } @@ -990,7 +990,7 @@ #set ( $column = $table.getColumn($columnName) ) #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) ) #set ( $colFK = $tblFK.getColumn($colFKName) ) - criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}()); + criteria.add(${className}Peer.${colFK.PeerJavaName}, ${column.GetterName}()); #end #if ($objectIsCaching) if (!last${relCol}Criteria.equals(criteria)) @@ -1170,9 +1170,8 @@ public Object getByPeerName(String name) { #foreach ($col in $table.Columns) - #set ( $cup=$col.Name.toUpperCase() ) #set ( $cjtype = $col.JavaNative ) - if (name.equals(${table.JavaName}Peer.$cup)) + if (name.equals(${table.JavaName}Peer.${col.PeerJavaName})) { #if ($cjtype == "int") return new Integer(${col.GetterName}()); @@ -1211,8 +1210,7 @@ throws TorqueException, IllegalArgumentException { #foreach ($col in $table.Columns) - #set ( $cup=$col.Name.toUpperCase() ) - if (${table.JavaName}Peer.${cup}.equals(name)) + if (${table.JavaName}Peer.${col.PeerJavaName}.equals(name)) { return setByName("${col.JavaName}", value); } @@ -1273,7 +1271,7 @@ { #set ($i = 0) #foreach ($col in $table.Columns) - #set ( $cup=$col.Name.toUpperCase() ) + #set ( $cup=$col.PeerJavaName ) if (position == $i) { return setByName("${col.JavaName}", value); Modified: db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm?view=diff&rev=471417&r1=471416&r2=471417 ============================================================================== --- db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm (original) +++ db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm Sun Nov 5 04:58:35 2006 @@ -699,7 +699,7 @@ #set ( $column = $table.getColumn($columnName) ) #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) ) #set ( $colFK = $tblFK.getColumn($colFKName) ) - criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}() ); + criteria.add(${className}Peer.${colFK.PeerJavaName}, ${column.GetterName}() ); #end $collName = ${className}Peer.doSelect(criteria); } @@ -717,7 +717,7 @@ #set ( $column = $table.getColumn($columnName) ) #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) ) #set ( $colFK = $tblFK.getColumn($colFKName) ) - criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}()); + criteria.add(${className}Peer.${colFK.PeerJavaName}, ${column.GetterName}()); #end #if ($objectIsCaching) if (!last${relCol}Criteria.equals(criteria)) @@ -791,7 +791,7 @@ #set ( $column = $table.getColumn($columnName) ) #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) ) #set ( $colFK = $tblFK.getColumn($colFKName) ) - criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}()); + criteria.add(${className}Peer.${colFK.PeerJavaName}, ${column.GetterName}()); #end $collName = ${className}Peer.doSelect(criteria, con); } @@ -809,7 +809,7 @@ #set ( $column = $table.getColumn($columnName) ) #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) ) #set ( $colFK = $tblFK.getColumn($colFKName) ) - criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}()); + criteria.add(${className}Peer.${colFK.PeerJavaName}, ${column.GetterName}()); #end #if ($objectIsCaching) if (!last${relCol}Criteria.equals(criteria)) @@ -919,7 +919,7 @@ #set ( $column = $table.getColumn($columnName) ) #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) ) #set ( $colFK = $tblFK.getColumn($colFKName) ) - criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}()); + criteria.add(${className}Peer.${colFK.PeerJavaName}, ${column.GetterName}()); #end $collName = ${className}Peer.doSelectJoin${relCol2}(criteria); } @@ -934,7 +934,7 @@ #set ( $column = $table.getColumn($columnName) ) #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) ) #set ( $colFK = $tblFK.getColumn($colFKName) ) - criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}()); + criteria.add(${className}Peer.${colFK.PeerJavaName}, ${column.GetterName}()); #end #if ($objectIsCaching) if (!last${relCol}Criteria.equals(criteria)) @@ -989,7 +989,7 @@ #set ( $column = $table.getColumn($columnName) ) #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) ) #set ( $colFK = $tblFK.getColumn($colFKName) ) - criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}()); + criteria.add(${className}Peer.${colFK.PeerJavaName}, ${column.GetterName}()); #end $collName = ${className}Peer.doSelectJoinAllExcept${table.JavaName}${suffix}(criteria); } @@ -1005,7 +1005,7 @@ #set ( $column = $table.getColumn($columnName) ) #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) ) #set ( $colFK = $tblFK.getColumn($colFKName) ) - criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}()); + criteria.add(${className}Peer.${colFK.PeerJavaName}, ${column.GetterName}()); #end #if ($objectIsCaching) if (!last${relCol}Criteria.equals(criteria)) @@ -1185,9 +1185,8 @@ public Object getByPeerName(String name) { #foreach ($col in $table.Columns) - #set ( $cup=$col.Name.toUpperCase() ) #set ( $cjtype = $col.JavaNative ) - if (name.equals(${table.JavaName}Peer.$cup)) + if (name.equals(${table.JavaName}Peer.${col.PeerJavaName})) { #if ($cjtype == "int") return new Integer(${col.GetterName}()); @@ -1226,8 +1225,7 @@ throws TorqueException, IllegalArgumentException { #foreach ($col in $table.Columns) - #set ( $cup=$col.Name.toUpperCase() ) - if (${table.JavaName}Peer.${cup}.equals(name)) + if (${table.JavaName}Peer.${col.PeerJavaName}.equals(name)) { return setByName("${col.JavaName}", value); } @@ -1288,7 +1286,6 @@ { #set ($i = 0) #foreach ($col in $table.Columns) - #set ( $cup=$col.Name.toUpperCase() ) if (position == $i) { return setByName("${col.JavaName}", value); Modified: db/torque/templates/trunk/src/templates/om/Peer.vm URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/Peer.vm?view=diff&rev=471417&r1=471416&r2=471417 ============================================================================== --- db/torque/templates/trunk/src/templates/om/Peer.vm (original) +++ db/torque/templates/trunk/src/templates/om/Peer.vm Sun Nov 5 04:58:35 2006 @@ -91,11 +91,9 @@ } #foreach ($col in $table.Columns) - #set ( $tfc=$table.JavaName ) #set ( $cfc=$col.JavaName ) - #set ( $cup=$col.Name.toUpperCase() ) - /** the column name for the $cup field */ - public static final String $cup; + /** the column name for the ${col.Name} field */ + public static final String ${col.PeerJavaName}; #end static @@ -104,11 +102,12 @@ TABLE_NAME = "$table.Name"; #foreach ($col in $table.Columns) - #set ( $tfc=$table.JavaName ) - #set ( $cfc=$col.JavaName ) - #set ( $cup=$col.Name.toUpperCase() ) - #set ( $cnm=$col.Name ) - $cup = "${table.Name}.$cnm"; + #if ( ! ${deprecatedUppercasePeer} ) + ${col.PeerJavaName} = "${col.FullyQualifiedName}"; + #else + #set ( $cup=$col.Name.toUpperCase() ) + ${col.PeerJavaName} = "${table.Name}.$cup}"; + #end #end if (Torque.isInit()) { @@ -218,7 +217,6 @@ #set ($col = $table.ChildrenColumn) #set ( $tfc=$table.JavaName ) #set ( $cfc=$col.JavaName ) - #set ( $cup=$col.Name.toUpperCase() ) #if ($col.isEnumeratedClasses()) ## NOTE: this hack requires a class type definition column to @@ -1174,8 +1172,8 @@ #foreach ($columnName in $fk.LocalColumns) #set ( $column = $table.getColumn($columnName) ) #set ( $columnFk = $joinTable.getColumn( $lfMap.get($columnName) ) ) - criteria.addJoin(${table.JavaName}Peer.$column.Name.toUpperCase(), - ${joinClassName}Peer.$columnFk.Name.toUpperCase()); + criteria.addJoin(${table.JavaName}Peer.$column.PeerJavaName, + ${joinClassName}Peer.$columnFk.PeerJavaName); #end correctBooleans(criteria); @@ -1328,7 +1326,7 @@ #foreach ($columnName in $fk.LocalColumns) #set ( $column = $table.getColumn($columnName) ) #set ( $columnFk = $joinTable.getColumn( $lfMap.get($columnName) ) ) - criteria.addJoin(${table.JavaName}Peer.$column.Name.toUpperCase(), ${joinClassName}Peer.$columnFk.Name.toUpperCase()); + criteria.addJoin(${table.JavaName}Peer.$column.PeerJavaName, ${joinClassName}Peer.$columnFk.PeerJavaName); #end #if($index < $table.ForeignKeys.size()) #set ( $new_index = $index + 1 ) --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org