Hello again !

I figured out, that you can set the database to use, by stating the
name in the schema xml file. This name then gets hardcoded into the
code and is used to access the correct database.

This works for me, but I still think that the behavior described by me
is a bug in Torque. When I explicitely use a certain database connection
to load an object, all associated objects should be loaded through the
same connection, since they won't be held on a different database.

Greetings
Jan Rohwer

-----Urspr�ngliche Nachricht-----
Von: Rohwer, Jan [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 21. Januar 2003 15:53
An: '[EMAIL PROTECTED]'
Betreff: Problem with second database



Hi everybody !

First of all I like to say, that I like the easy way in which you can
use your DataObjects with Torque.

But I have a problem:
I'm using Jetspeed and since I don't want to move the default data, I
created
a second database in Torque.properties.
So far so good. I then want to query some DataObjects from this non-default
database.
I use the following code:

Connection con = Torque.getConnection("myDB");
List list = ObjPeer.doSelect(new Criteria(), con);

This works fine, and now I have a list of Objs. These are objects which also
have a foreign key 
relation to another table in the database. When I now try to access one of
these objects with
the supplied getter, I get a TorqueException. I figured out, that Torque
uses the default database
connection to try and load this object. This should definitely not happen,
since I loaded the
original object through my self-defined connection.

One possible solution is to use the doSelectJoin and set the database name
in the Criteria object,
but I don't want to load all associated objects at once.

Is there any other way to do this ?? Or is this actually a bug ?

Thanks in advance

Jan Rohwer


Jan Rohwer
LogicaCMG <http://www.logicacmg.com/de/>
Insurance - Financial Services
Osterbekstr. 90b
22083 Hamburg
Tel.  : +49 40 27071-391
EMail : [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>


This e-mail and any attachment is for authorised use by the intended
recipient(s) only.  It may contain proprietary material, confidential
information and/or be subject to legal privilege.  It should not be copied,
disclosed to, retained or used by, any other party.  If you are not an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender.  Thank you.

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

This e-mail and any attachment is for authorised use by the intended recipient(s) 
only.  It may contain proprietary material, confidential information and/or be subject 
to legal privilege.  It should not be copied, disclosed to, retained or used by, any 
other party.  If you are not an intended recipient then please promptly delete this 
e-mail and any attachment and all copies and inform the sender.  Thank you.

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to