You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Ivano Luberti <lu...@archicoop.it> on 2009/03/11 16:50:46 UTC

possible bug in Torque3.3 using two databases

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.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org