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 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.setFinish(f);
>((ExtTransaction) tx).flush() // post INSERT queries
>f.setDrawer(d);
>tx.commit();
>
>If you have to delete one object, you have to break the circular reference
>in the same way.
>
>tx.lock(d);
>d.setFinish(null);
>ExtTx.flush(); // post UPDATE set FINISHPK=null
>Impl.getDatabase().deletePersistent(f);
>tx.commit();
>
>Don't change java class definition (circular references relations), write
>your processes as you should do with JDBC only.
>
>Bruno.
>
>On 12/6/06, Armin Waibel <[EMAIL PROTECTED]> wrote:
>>
>>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.
>>
>>Is there a way to correct this problem without changing the Java class
>>definitions ?
>>
>>Thanks and Regards,
>>Gautam.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>


 

Reply via email to