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 "Brian K. Wallace" <br...@transmorphix.com> on 2003/04/14 01:10:44 UTC

setDbName

I'm running an application that deals with more than one 'instance' of a database 
(identical tables, columns, etc - just different data). I'm trying to use Criteria's 
'setDbName' to configure the connection to use (as defined in Torque.properties) 
and I hit a 'null' coming back from BasePeer's createQuery (line 1209) via 
BasePeer's doSelect (line 1334).  I'm not in the position to know how many 
databases there will be, but I do know they will all be identical - and can configure the 
jdbc connections on the fly, so the ability so setDbName to just point Torque to a 
different connection is exactly what I need, but I can't seem to get past the 
BasePeer's NullPointerException.

Any help would be greatly appreciated.


Re: setDbName

Posted by "Brian K. Wallace" <br...@transmorphix.com>.
To further clarify where I'm getting the exception, I have the following code:

    Criteria crit = new Criteria();
    if (dbName != null) {
      crit.setDbName(dbName);
    }

[I've also gone the "new Criteria(dbName)" route with 
identical results]

If I perform a doSelect(crit) at this point, it works as 
expected. However, if I add the following line prior to 
executing the doSelect(crit), I always get a 
NullPointerException from the Base:

 crit.addAscendingOrderByColumn(MyPeer.SORT_NUMBER);

(Where 'MyPeer.SORT_NUMBER' is valid - and works if the 
criteria is against the 'default' database)

  I haven't gone too far into the code, but this is looking 
more like a bug.


> I'm running an application that deals with more than one 'instance' of a database 
> (identical tables, columns, etc - just different data). I'm trying to use Criteria's 
> 'setDbName' to configure the connection to use (as defined in Torque.properties) 
> and I hit a 'null' coming back from BasePeer's createQuery (line 1209) via 
> BasePeer's doSelect (line 1334).  I'm not in the position to know how many 
> databases there will be, but I do know they will all be identical - and can configure the 
> jdbc connections on the fly, so the ability so setDbName to just point Torque to a 
> different connection is exactly what I need, but I can't seem to get past the 
> BasePeer's NullPointerException.
> 
> Any help would be greatly appreciated.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
>