RE: Removing from object graph

From: Cris Daniluk (cris.danilu..laraview.com)
Date: Tue Feb 01 2005 - 16:18:41 EST

  • Next message: Andrus Adamchik: "RE: Removing from object graph"

    I actually just set the relationship to nullify, as I thought it was
    already, but I'm still having the CME unless I clone the list as you
    suggest. That seems a little funky to me... Is it feasible to switch that to
    a collection type that supports concurrent modification, like a vector?

    Cris

    > -----Original Message-----
    > From: Andrus Adamchik [mailto:andru..bjectstyle.org]
    > Sent: Tuesday, February 01, 2005 3:57 PM
    > To: cayenne-use..bjectstyle.org
    > Subject: Re: Removing from object graph
    >
    > Cris,
    >
    > Cloning an array before iterating over it would do the trick
    > (leave the
    > rest of the code unchaged):
    >
    > List tempList = new ArrayList(document.getDocumentWorkflowArray());
    > Iterator workflowIter = tempList.iterator();
    >
    > To make it even simpler than that you can set delete rule for
    > relationship
    > from DocumentWorkflow to Document to "nullify" in the modeler. In this
    > case you won't need "removeFromDocumentWorkflowArray" line as it will
    > happen automatically (you'd still need to iterate over a copy of the
    > relationship list).
    >
    > And finally using iter.remove() in combination with
    > context.deleteObject()
    > should also work, though I haven't tested it myself.
    >
    > Andrus
    >



    This archive was generated by hypermail 2.0.0 : Tue Feb 01 2005 - 16:18:16 EST