I've researched and discovered the bug I was experiencing with doUpdate.
The "isNew()" flag on my Torque-generated objects always returns true,
even if the object has already been saved to the DB. This caused an exception
during doUpdate.
I've modifed Torque so that the isNew flag is set correctly after
a successful insert or select. This took care of my problem. Please
review my patches below and let me know if it's OK to commit.
Also, I removed a couple of toUpperCase() calls in MapBuilder.vm.
It was capitalizing my column names although MySQL is using
mixed case as specified in my XML schema. This caused my
queries to fail, since MySQL is apparently case sensitive. It seems
to make sense to leave the case as specified in the XML.
% cvs diff -u Peer.vm
Index: Peer.vm
===================================================================
RCS file: /products/cvs/turbine/turbine/conf/torque/templates/om/Peer.vm,v
retrieving revision 1.12
diff -u -r1.12 Peer.vm
--- Peer.vm 2001/01/05 17:09:49 1.12
+++ Peer.vm 2001/01/10 17:08:39
@@ -167,8 +167,8 @@
#end
#if ($addSaveMethod)
obj.setModified(false);
- obj.setNew(false);
#end
+ obj.setNew(false);
return obj;
}
@@ -470,6 +470,7 @@
public static void doInsert( $table.JavaName obj ) throws Exception
{
obj.setPrimaryKey(doInsert(buildCriteria(obj)));
+ obj.setNew(false);
}
/**
@@ -497,6 +498,7 @@
public static void doInsert( $table.JavaName obj, DBConnection dbCon) throws
Exception
{
obj.setPrimaryKey(doInsert(buildCriteria(obj), dbCon));
+ obj.setNew(false);
}
/**
% cvs diff -u MapBuilder.vm
Index: MapBuilder.vm
===================================================================
RCS file: /products/cvs/turbine/turbine/conf/torque/templates/om/MapBuilder.vm,v
retrieving revision 1.11
diff -u -r1.11 MapBuilder.vm
--- MapBuilder.vm 2001/01/03 20:14:39 1.11
+++ MapBuilder.vm 2001/01/10 17:09:28
@@ -26,7 +26,7 @@
#foreach ($col in $table.Columns)
#set ( $tfc=$table.JavaName )
#set ( $cfc=$col.JavaName )
- #set ( $cup=$col.Name.toUpperCase() )
+ #set ( $cup=$col.Name )
/** ${table.Name}.$cup */
public static String get${tfc}_${cfc}()
@@ -83,7 +83,7 @@
#foreach ($col in $table.Columns)
#set ( $tfc=$table.JavaName )
#set ( $cfc=$col.JavaName )
- #set ( $cup=$col.Name.toUpperCase() )
+ #set ( $cup=$col.Name )
#if($col.isPrimaryKey())
#if($col.isForeignKey())
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]