Unlike Hibernate, the object graph is maintained even before you save.
If you use "mySecondObject.setTheObject(myFirstObject)", then the equivalent for "myFirstObject.addToMyRelation(mySecondObject)" is already done for you. This is why you're seeing two copies -- you're effectively calling the addToMyRelationship twice. On 6/19/07, Alexander Lamb (dev) <[EMAIL PROTECTED]> wrote:
Hello list, It looks like "myFirstObject.addToMyRelation(mySecondObject)" does not check if mySecondObject is already in the relationship. Is that correct? If so, here is my problem. I know that I can simply do: mySecondObject.setTheObject(myFirstObject) and then once saved, somehow the reverse relationship will be updated. The problem is that I need the reverse relationship before I save. Therefore I do: mySecondObject.setTheObject(myFirstObject) and myFirstObject.addToMyRelation(mySecondObject) In order to have my object graph correct before save. Unfortunately, doing this it seems like mySecondObject gets inserted twice in the List. If I restart the app, everything is fine again. Thanks for any hint! Alex
