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.
+ * <p>
+ * 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.
* <p>
* 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.
* <p>
* 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.<p>
- *
- * 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.
</td>
</tr>
+ <tr>
+ <td><code>torque.deprecated.uppercasePeer</code></td>
+ <td><code>false</code></td>
+ <td>
+ 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.
+ </td>
+ </tr>
<tr>
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 @@
<body>
<release version="3.2.1-dev" date="in SVN">
+ <action type="add" dev="tfischer" issue="TORQUE-44" due-to="Greg Monroe">
+ The Column names TABLE_NAME and DATABASE_NAME are now legal column
names.
+ </action>
<action type="add" dev="tfischer" issue="TORQUE-2" due-to="Raphael
Pieroni">
- Added maven 2 plugin.
+ Added a maven 2 plugin.
</action>
<action type="fix" dev="tfischer" issue="TORQUE-57">
Fixed handling of escaping (by backslashes) for LIKE clauses.
@@ -69,18 +72,20 @@
</action>
<action type="update" dev="tfischer" issue="TORQUE-37" due-to="Greg
Monroe">
The default package for generated classes was changed from
- <code>org.apache.torque</code> to <code>torque.generated</code>.
+ org.apache.torque to torque.generated.
</action>
- <action type="fix" dev="tfischer" issue="TORQUE-44" due-to="Thoralf
Rickert">
- Selects for BOOLEANCHAR and BOOLEANINT now works for aliased tablenames
+ <action type="fix">
+ Selects for BOOLEANCHAR and BOOLEANINT now work for aliased tablenames
and joined tables.
</action>
- <action type="fix" dev="tfischer" issue="TORQUE-44" due-to="Thoralf
Rickert">
+ <action type="fix" dev="tfischer" issue="TORQUE-44" due-to="Thoralf
Rickert and Greg Monroe">
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.<br/>
+ The old behaviour can be regained by setting the generator property
+ torque.deprecated.uppercasePeer to true.
</action>
<action type="update" dev="tv">
Simplified the Torque Avalon component.
@@ -654,7 +659,7 @@
<action type="add" dev="henning">
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 <code>torque.correctGetters</code> 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.
</action>
<action type="update" dev="henning">
@@ -666,8 +671,8 @@
<release version="3.1.1" date="2004-10-26">
<action type="update" dev="henning">
- Change PostgreSQL ID generation to use <code>select nextval</code>
- instead of <code>select currval</code>.
+ Change PostgreSQL ID generation to use select nextval
+ instead of select currval.
</action>
<action type="update" dev="seade" issue="TRQS235">
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
<code>doDelete(object)</code> work if your
+ For everyone else, this change might actually make doDelete(object) work
if your
object contains a binary column.
</action>
<action type="update" dev="henning" issue="TRQS222">
@@ -698,7 +703,7 @@
Add Torque Reporting to the Maven plugin. Patch contributed by Thierry
Lach.
</action>
<action type="update" dev="henning" issue="TRQS207">
- Make <code>org.apache.torque.util.SqlEnum</code> 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.
</action>
<action type="update" dev="henning" issue="TRQS239">
@@ -731,15 +736,15 @@
file. Activated the maven-changes-report.
</action>
<action type="update">
- Changed the default property value for <code>torque.output.dir</code>
- from <code>maven.build.dest</code> to <code>maven.build.dir</code>.
+ 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
- <code>target</code> rather than the <code>target/classes</code>
+ target rather than the target/classes
directory. The properties reference was updated accordingly (a few
missing properties were also documented).
</action>
<action type="update" dev="henning">
- Add missing method <code>retrieveByPK(native type, Connection)</code>
+ Add missing method retrieveByPK(native type, Connection)
method to the generated peer classes
</action>
<action type="add" dev="henning">
@@ -777,8 +782,8 @@
</release>
<release version="3.1.1-RC2" date="2004-08-27">
<action type="fix" dev="henning">
- <code>limit</code> and <code>offset</code> handling for all databases
- other than DB2 was broken. <code>limit</code> and <code>offset</code>
+ 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.
</action>
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 @@
<p>
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.
+ </p>
+
+ <p>
+ 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.
+ </p>
+
+ <p>
+ 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:
<ul>
- <li>TABLE_NAME</li>
- <li>DATABASE_NAME</li>
+ <li>TABLE_NAME => _TABLE_NAME</li>
+ <li>DATABASE_NAME => _DATABASE_NAME</li>
</ul>
+ </p>
+
+ <p>
+ Note that prior to Release 3.2.1, using these two column names WILL produce
+ duplicate constants and uncompilable code.
</p>
<p>
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]