Duplicates in to-many relationships

From: Alexander Lamb (dev) ("Alexander)
Date: Tue Jun 19 2007 - 12:08:07 EDT

  • Next message: Mike Kienenberger: "Re: Duplicates in to-many relationships"

    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



    This archive was generated by hypermail 2.0.0 : Tue Jun 19 2007 - 12:08:36 EDT