While playing around with the new TDK/Torque if found two small but
nasty bugs.
Patches are included below.
Bug No. 1:
----------
If you create a database schema with a database name other then
"default"
(eg. <database name="tdm">), the Peers for this database fail, when
performing a doUpdate(), because the selectCriteria is created for the
default-database, while the updateCriteria has the dbName set correct
from
databaseMap. So the two criterias point to different databases and
BasePeer.doUpdate
throws a NullPointerException.
Following a patch, which creates the correct selectCriteria.
Index: Peer.vm
===================================================================
RCS file:
/products/cvs/turbine/turbine/conf/torque/templates/om/Peer.vm,v
retrieving revision 1.20
diff -u -r1.20 Peer.vm
--- Peer.vm 2001/02/04 19:04:31 1.20
+++ Peer.vm 2001/02/06 22:14:53
@@ -267,7 +267,7 @@
public static void doUpdate(Criteria criteria) throws Exception
{
criteria.setDbName(mapBuilder.getDatabaseMap().getName());
- Criteria selectCriteria = new Criteria(2);
+ Criteria selectCriteria = new
Criteria(mapBuilder.getDatabaseMap().getName(), 2);
#foreach ($col in $table.Columns)
#set ( $cup=$col.Name.toUpperCase() )
#if($col.isBooleanInt())
@@ -322,7 +322,7 @@
public static void doUpdate(Criteria criteria, DBConnection dbCon)
throws Exception
{
criteria.setDbName(mapBuilder.getDatabaseMap().getName());
- Criteria selectCriteria = new Criteria(2);
+ Criteria selectCriteria = new
Criteria(mapBuilder.getDatabaseMap().getName(), 2);
#foreach ($col in $table.Columns)
#set ( $cup=$col.Name.toUpperCase() )
#if($col.isBooleanInt())
Bug No. 2:
----------
If I create columns with type="TINYINT" they get translated to the java
type "byte" in the
BaseObject Classes. This is correct for my database (MySQL).
In the velocity-template generating the setXXX(byte v) methods the test
for the
java base type "byte" is missing and a wrong if-statement for comparing
equality of values
is generated. This causes compile time errors.
Following a patch with the added check for "byte".
Index: Object.vm
===================================================================
RCS file:
/products/cvs/turbine/turbine/conf/torque/templates/om/Object.vm,v
retrieving revision 1.18
diff -u -r1.18 Object.vm
--- Object.vm 2001/02/01 17:43:01 1.18
+++ Object.vm 2001/02/06 22:19:07
@@ -109,7 +109,7 @@
#if ( ($cjtype == "int") || ($cjtype == "long") || ($cjtype ==
"boolean")
|| ($cjtype == "short") || ($cjtype == "float") || ($cjtype ==
"double")
- || ($cjtype == "char") )
+ || ($cjtype == "char") || ($cjtype == "byte") )
if (this.$clo != v)
#else
if ( !ObjectUtils.equals(this.$clo, v) )
--
Christof
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]