Hi Armin,

I am using PB and do not need any distributed transactions. I asked this
question because I experience some difficulties with 1:N references where
one object is stored in db1 and the n objects are stored in db2. in this
case auto-retrieve="true" of course fails. but even when I try to get the
object from db1 and do a broker.retrieveAllReferences(object) it is not
working. But I guess this should work. In the mail-archives I found this
message from Thomas:

 >Can I store parts of an object in one DB and other parts in another? If
so,
> how do I
> then build the complete object during lookup?

>Say you have databases A and B. You also have two classes ClassA (mapped 
>to A) and ClassB (mapped to B).

>ClassA holds a reference to a ClassB object.

>now follow these steps:
>1. obtain two broker instances brokerA and brokerB working against the A 
>and B database respectively.

>2. call
>ClassA a = (ClassA) brokerA.getObjectByQuery(...);

>to load the instance a. To avoid automatic (and in this case wrong) 
>retrieval of the ClassB reference the respective reference-descriptor 
>must be set to auto-retrieve="false"

>3. call
>brokerB.retrieveAllReferences(a);
>to use the brokerB to retrieve the ClassB reference explicitely.

>cheers,
>Thomas


I am not sure if I mix something up and understand you right, but you
mentioned that this cannot be handled by OJB?

Dirk



-----Urspr�ngliche Nachricht-----
Von: Armin Waibel [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 18. Februar 2004 18:02
An: OJB Users List
Betreff: Re: auto... not possible when using multiple databases?

Hi Dirk,

Dirk Manske (Service Respond) wrote:
> Hi,
> 
> for reference attributes you can declare auto-retrieve, auto-update 
> and auto-delete to true in the respective descriptor. My question is: 
> Do I have to set these properties to false when using multiple 
> databases and do all the work manually?
>

Why? These attributes has in effect nothing to do with multiple DB
connections (except see below).

But there are some pitfalls:
- take care of ObjectCache when same classes used in different DB
- if you need distributed tx, you have to run OJB in a managed environment
(JTA support)
- say class A has a collection of B's and A should be stored in DB A, all
B's in DB B. OJB can't handle this for you internal (need of distributed
tx). Handle this on a higher level (in managed environment). 
In fact, then you have to disable the auto-XXX flags.

regards,
Armin

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

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


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

Reply via email to