Hi, >>hmm, indeed in theory this should work for read, but I never test it. >>Do I understand you: >>- Get object from DB1 using broker_1 >>- Get broker_2 (using PBKey for DB2) and do broker2.retrieveReference(object, "attributeName")
>>This cause an exception? No exception. There are just no objects referenced. I try for db1 broker1.getObjectPerson. ObjectPerson is materialized. Then I do broker2.retrieveAllReferences(ObjectPerson). broker2 (using PBKey) is configured for a different database of course. Today we had to change the database model. We have now two schemas, this is why I have to use to brokers. Before the database model has been changed OJB handled the reference stuff automagically and it worked. If retrieveAllReferences for objects across multiple databases should work I would be glad to see a little example as I struggled with this. Currently I retrieve all cross db-references manually which is a nightmare... Dirk -----Urspr�ngliche Nachricht----- Von: Armin Waibel [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 19. Februar 2004 00:25 An: OJB Users List Betreff: Re: AW: auto... not possible when using multiple databases? Hi, Dirk Manske (Service Respond) wrote: > 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. right, this is the exception you have to disable the auto-XXX flags. > 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: > hmm, indeed in theory this should work for read, but I never test it. Do I understand you: - Get object from DB1 using broker_1 - Get broker_2 (using PBKey for DB2) and do broker2.retrieveReference(object, "attributeName") This cause an exception? > >Can I store parts of an object in one DB and other parts in another? > If so, > This can't be handled by OJB. Here you need an additional layer on top of OJB and you need distributed transaction an store/delete. The layer detect where to store the main object and all references. On read the layer does things described above. regards, Armin >>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] > > > --------------------------------------------------------------------- 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]
