db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vlada Djurovic <vdjuro...@gmail.com>
Subject Re: hsqldb and NullPointerException
Date Fri, 17 Jun 2005 12:02:55 GMT
> Hi Vlada,
> 
> look at
> http://issues.apache.org/scarab/issues/id/TRQS228
> to read about the problem in detail.
> 
> In a nutshell, for each table in a query, the corresponding Peer class has
> to be loaded before the table can be used in a query. Loading the class
> executes its static initializer and registers the Map Builder for the
> table.
> Since Torque 3.1.1, this is done if a coulumn name constant (like
> PatientPeer.FIRSTNAME) in the Peer is accessed.
> In earlier versions of Torque, this is done e.g. if you access a method of
> the Peer (like PatientPeer.doInsert()).
> So in your case, because you are accessing a method of the Peer for the
> query, this should be ok for any versions of Torque.
> 
> I would guess that you have some unusual setup which breaks this mechanism.
> (e.g., some weeks ago, someone had the same problem because he was using
> Joins and RMI). To shed light on this, can you put a debug message in the
> static initializer of BasePatientPeer to see when it is called ?
> 
> Please keep us informed about your findings
> 
>      Thomas
> 
> 
OK, here's what I have so far:
-I recompiled torque-3.1.1, and added this to
BasePeer.doInsert(Criteria,Connection):

DatabaseMap dbMap = Torque.getDatabaseMap(criteria.getDbName());
        System.out.println("BasePeer: dbName="+criteria.getDbName());
        dbMap.printTables(); //added this in DatabaseMap to print tables
        TableMap tableMap = dbMap.getTable(tableName);
        if(tableMap==null)
            System.out.println("tableMap==null");

And after running the code, this is the output:

In statis initializer
Peer initialized
BasePeer: tableName=patient
BasePeer: dbName=cardiobip
DBMap tables: {ID_TABLE=org.apache.torque.map.TableMap@49cf9f}
tableMap==null
Exception occurred during event dispatching:
java.lang.NullPointerException
        at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:666)
        at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:603)
        at com.euroicc.cardiobip.om.BasePatientPeer.doInsert(BasePatientPeer.ja
a:228)
        at com.euroicc.cardiobip.om.BasePatientPeer.doInsert(BasePatientPeer.ja
a:201)
        at com.euroicc.cardiobip.gui.NewPatientDialog.OKButtonActionPerformed(N

So, I guess DBMap contains only one table, ID_TABLE and table
'patient' can not be found.

But I have no clue what could be causing this. I suppose you are right
about it being a configuration issue, but what?

@Raphael:
I tried using object instead of criteria, but it's the same

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


Mime
View raw message