Not a bad idea. A Jira task maybe?
Andrus
On Feb 1, 2005, at 5:40 PM, Cris Daniluk wrote:
> iter.remove() should work fine if its invoked before the deleteObject()
> call, though I think a better general solution would be to deprecate
> deleteObject(DataObject) and use deleteObjects(Collection), as was
> done with
> invalidateObjects, unregisterObjects, localObjects, etc in 1.1. This
> still
> requires the list copy, but at least deleteObjects isolates the user
> from
> that.
>
> Cris
>
>> -----Original Message-----
>> From: Andrus Adamchik [mailto:andru..bjectstyle.org]
>> Sent: Tuesday, February 01, 2005 4:24 PM
>> To: cayenne-use..bjectstyle.org
>> Subject: RE: Removing from object graph
>>
>> 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
>>>>
>>
>>
>>
>>
> <deleteObjects.patch>
This archive was generated by hypermail 2.0.0 : Tue Feb 01 2005 - 18:29:51 EST