henning 2004/10/26 05:48:31
Modified: src/generator/src/templates/om Tag: TORQUE_3_1_BRANCH
Peer.vm
Log:
And here it is, the very, very, very last second bug fix.
The fix for TRQS230 broke binary columns for insert and update. The
bug as actually caught by a Turbine Unit test and pointed out by Scott
but I didn't recognize it as a Torque bug until I started rolling
release versions.
This bug fix warrants IMHO to move the TORQUE_3_1_1 tag (just a little...)
Revision Changes Path
No revision
No revision
1.5.2.12 +19 -3 db-torque/src/generator/src/templates/om/Peer.vm
Index: Peer.vm
===================================================================
RCS file: /home/cvs/db-torque/src/generator/src/templates/om/Peer.vm,v
retrieving revision 1.5.2.11
retrieving revision 1.5.2.12
diff -u -r1.5.2.11 -r1.5.2.12
--- Peer.vm 20 Oct 2004 21:54:30 -0000 1.5.2.11
+++ Peer.vm 26 Oct 2004 12:48:30 -0000 1.5.2.12
@@ -744,7 +744,7 @@
*/
public static List doSelect($table.JavaName obj) throws TorqueException
{
- return doSelect(buildCriteria(obj));
+ return doSelect(buildSelectCriteria(obj));
}
/**
@@ -782,7 +782,7 @@
*/
public static void doDelete($table.JavaName obj) throws TorqueException
{
- doDelete(buildCriteria(obj));
+ doDelete(buildSelectCriteria(obj));
}
/**
@@ -837,7 +837,7 @@
public static void doDelete($table.JavaName obj, Connection con)
throws TorqueException
{
- doDelete(buildCriteria(obj), con);
+ doDelete(buildSelectCriteria(obj), con);
}
/**
@@ -889,6 +889,22 @@
/** Build a Criteria object from the data object for this peer */
public static Criteria buildCriteria( $table.JavaName obj )
+ {
+ Criteria criteria = new Criteria(DATABASE_NAME);
+ #foreach ($col in $table.Columns)
+ #set ( $cfc=$col.JavaName )
+ #set ( $cup=$col.Name.toUpperCase() )
+ #set ( $cjtype = $col.JavaNative )
+ #if ($col.isPrimaryKey() && !$table.IdMethod.equals("none"))
+ if (!obj.isNew())
+ #end
+ criteria.add($cup, obj.get${cfc}());
+ #end
+ return criteria;
+ }
+
+ /** Build a Criteria object from the data object for this peer, skipping all
binary columns */
+ public static Criteria buildSelectCriteria( $table.JavaName obj )
{
Criteria criteria = new Criteria(DATABASE_NAME);
#foreach ($col in $table.Columns)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]