opensubscriber
   Find in this group all groups
 
Unknown more information…

t : torque-user@db.apache.org 12 March 2009 • 12:50AM -0400

possible bug in Torque3.3 using two databases
by Ivano Luberti

REPLY TO AUTHOR
 
REPLY TO GROUP




Hello, I think I have discovered a possible bug in Torque3.3 run time.
My code does the following (simplilfied):

1) select some records from table1 in db1 using table1Peer.doSelect
(Criteria)

2) import some of those records in table2 in db2 (default db set into
Torque.properties)

3) update the record the have been imported in table1 db1 using
table1Peer.doUpdate(whereC,updateC);

Step 3) fails with a null pointer exception.
The null pointer is generated by line 1676 of BasePeer.java

ColumnMap[] columnMaps = dbMap.getTable(table).getColumns();

because dbMap.getTable(table) is null.

the table is obtained using the same peer class used at the step 1)
however I have noticed that at line 1667

DatabaseMap dbMap = Torque.getDatabaseMap(dbName);

has the dbName set to db2 and not db1.

Going deeper into the code I have noticed that during execution of step
1) is called

BaseTable1Peer.setDbName(Criteria crit) and changes from db2 to db1 the
dbname set into criteria by default (that is I believe the default db
set into Torque.properties)

The same method is not called at step3.

I have worked around this setting explicitly the dbname of whereC and
updateC used at step 3 , but it seems to me this is indeed a bug.


--
==================================================
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==================================================


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.a...
For additional commands, e-mail: torque-user-help@db.a...

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

opensubscriber is not affiliated with the authors of this message nor responsible for its content.