Hi,
Here's a patch to Object.vm that fixes two issues.
(1) The critical issue is at this marker
@@ -219,8 +220,7 @@
There's a carriage return in the middle of a statement that prevents
compilation of the generated OM java code.
(2) I had several fields in my legacy database that were the same as Java
reserved words. As Torque creates a private variable for each field, that was
a problem. I changed the name of this private variable to have "_t" appended
to the end of the field name.
WILL
------------------------------------
Will Glass-Husain <[EMAIL PROTECTED]>
Forio Business Simulations
office: (415) 440-7500
mobile: (415) 235-4293
cvs diff -u Object.vm
Index: Object.vm
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-torque/src/templates/om/Object.vm,v
retrieving revision 1.45
diff -u -r1.45 Object.vm
--- Object.vm 1 Aug 2002 16:51:38 -0000 1.45
+++ Object.vm 9 Aug 2002 18:33:35 -0000
@@ -1,3 +1,4 @@
+#set($jsuffix='_t')
#set ($db = $table.Database)
#if ($db.Package)
#set ($package = $db.Package)
@@ -73,7 +74,7 @@
#if (!$table.isAlias())
#foreach ($col in $table.Columns)
#set ( $cjtype = $col.JavaNative )
- #set ( $clo=$col.Name.toLowerCase() )
+ #set ( $clo=$col.Name.toLowerCase().concat($jsuffix) )
#set ($defVal = "")
#if ($col.DefaultValue && !$col.DefaultValue.equalsIgnoreCase("NULL") )
#set ( $quote = '' )
@@ -105,14 +106,14 @@
#end
/**
- * The value for the $clo field
+ * The value for the $col.Name field
*/
private $cjtype $clo$defVal;
#end
#foreach ($col in $table.Columns)
#set ( $cfc=$col.JavaName )
- #set ( $clo=$col.Name.toLowerCase() )
+ #set ( $clo=$col.Name.toLowerCase().concat($jsuffix) )
#set ( $cjtype = $col.JavaNative )
/**
@@ -219,8 +220,7 @@
{
for (int i = 0; i < ${collName}.size(); i++)
{
- ((${tblFK.JavaName}) ${collName}.get(i))
- .set${colFK.JavaName}(v);
+ ((${tblFK.JavaName})
+${collName}.get(i)).set${colFK.JavaName}(v);
}
}
#end
@@ -299,7 +299,7 @@
#foreach ($columnName in $fk.LocalColumns)
#set ( $column = $table.getColumn($columnName) )
#set ( $cjtype = $column.JavaNative )
- #set ( $clo=$column.Name.toLowerCase() )
+ #set ( $clo=$column.Name.toLowerCase().concat($jsuffix) )
#if ($cjtype == "short" || $cjtype == "int" || $cjtype == "long")
#set ( $conditional = "$conditional${and}this.${clo}>0" )
#else
@@ -1074,7 +1074,7 @@
#end
#end
- #set ( $clo=$col.Name.toLowerCase() )
+ #set ( $clo=$col.Name.toLowerCase().concat($jsuffix) )
#set ( $cjtype = $col.JavaNative )
#set ($argList = "${argList}$comma $cjtype $clo")
#set ($argList2 = "${argList2}$comma String $clo")
@@ -1085,7 +1085,7 @@
#if ($table.PrimaryKeys.size() == 1)
#set ($col = $table.PrimaryKeys.get(0) )
- #set ( $clo=$col.Name.toLowerCase() )
+ #set ( $clo=$col.Name.toLowerCase().concat($jsuffix) )
#set ( $cjtype= $col.JavaNative )
/**
* Set the PrimaryKey using ObjectKey.
@@ -1127,7 +1127,7 @@
* Set the PrimaryKey using SimpleKeys.
*
#foreach ($col in $table.PrimaryKeys)
- #set ( $clo=$col.Name.toLowerCase() )
+ #set ( $clo=$col.Name.toLowerCase().concat($jsuffix) )
#set ( $cjtype= $col.JavaNative )
* @param $cjtype $clo
#end
@@ -1136,7 +1136,7 @@
$throwsClause
{
#foreach ($col in $table.PrimaryKeys)
- set${col.JavaName}($col.Name.toLowerCase());
+ set${col.JavaName}($col.Name.toLowerCase().concat($jsuffix));
#end
}
@@ -1144,7 +1144,7 @@
* Set the PrimaryKey with Strings.
*
#foreach ($col in $table.PrimaryKeys)
- #set ( $clo=$col.Name.toLowerCase() )
+ #set ( $clo=$col.Name.toLowerCase().concat($jsuffix) )
* @param String $clo
#end
*/
@@ -1152,7 +1152,7 @@
$throwsClause
{
#foreach ($col in $table.PrimaryKeys)
- set${col.JavaName}(new ${col.JavaNative}($col.Name.toLowerCase()));
+ set${col.JavaName}(new
+${col.JavaNative}($col.Name.toLowerCase().concat($jsuffix)));
#end
}
@@ -1245,7 +1245,7 @@
protected $table.JavaName copyInto($table.JavaName copyObj) throws
TorqueException
{
#foreach ($col in $table.Columns)
- copyObj.set${col.JavaName}($col.Name.toLowerCase());
+ copyObj.set${col.JavaName}($col.Name.toLowerCase().concat($jsuffix));
#end
#if ($complexObjectModel)
@@ -1308,3 +1308,4 @@
}
#end
}
+
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>