Re: Circular references issue

2006-12-07 Thread Armin Waibel
Hi Gautam, Bruno is right, you have to do two steps on insert of objects with bidirectional references. Say class A and B have a bidirectional 1:1 reference, then do e.g. A a = new A(); B b = new B(); a.setB(b); // set one reference broker.beginTx broker.store(a,..); b.setA(a); // set other b

Re: Re: Circular references issue

2006-12-06 Thread Bruno CROS
Hello, I guess you have to do the 2 steps in the same way with PB API. Database constraints needs the same sequence of insert/update. If using PB API, i don't think you're dealing with rollback ability, if not, write the 2 steps as it were 2 standalone PB processes and it should work. Else, fi

Re: Re: Circular references issue

2006-12-06 Thread Virgo Smart
Hello, Is there a way to do the same using Persistence Broker APIs ? Thanks and Regards, Gautam. On Wed, 06 Dec 2006 Bruno CROS wrote : >The circular references have to be build in 2 steps : > >First, create instances and link one relation. >Flush (write SQL insert and update) >Second, link w

Re: Circular references issue

2006-12-06 Thread Bruno CROS
The circular references have to be build in 2 steps : First, create instances and link one relation. Flush (write SQL insert and update) Second, link with the second relation (in back side). Commit. Your example : tx.begin(); d = new Drawer(); f = new Finish(); tx.lock(d); tx.lock(f); d.setFini

Fwd: Circular references issue

2006-12-05 Thread Armin Waibel
Hello, I have a scenario in which there are two classes which reference each other. Eg. class Drawer references Finish and Finish references Drawer. When I attempt to persist Drawer instance, an exception is thrown suggesting that we cannot add or update a child row: a foreign key reference fails