IMO making sure that iter.remove()/context.deleteObject() works properly
in all cases makes more sense, and will be more in line with the [strange
though "standard"] ways of Java Collections API.
Andrus
> 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:23:47 EST