cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Behavior of "remove(object)" on ToManyList
Date Wed, 30 May 2007 09:24:09 GMT
Actually I see no problem with the list being modifiable, (dis) 
connecting a relationship on remove/add. This fits into the ORM  
model, as long as there is an understanding that a relationship list  
is connected to a persistence engine, the same way individual objects  
are.

Andrus



On May 30, 2007, at 6:20 AM, Kevin Menard wrote:
>> -----Original Message-----
>> From: Andrus Adamchik [mailto:andrus@objectstyle.org]
>> Sent: Thursday, May 24, 2007 5:52 AM
>> To: user@cayenne.apache.org
>> Subject: Re: Behavior of "remove(object)" on ToManyList
>>
>> Hi Alex,
>>
>> Well, actually one of Cayenne responsibilities is maintaining
>> consistent object graph. To-many lists are a part of that
>> object graph. So if you want to remove an object from the
>> list for presentation reasons, but keep the relationship
>> intact, the only right way is to clone the list and remove
>> items from the clone. I.e.:
>>
>> List centers = new ArrayList(getSelectedCountry().getCenters());
>
> Perhaps it would make sense if the relationships return unmodifiable
> Lists then?  It seems to me like it could clear up this whole class of
> problems.
>
> -- 
> Kevin
>


Mime
View raw message