RE: Behavior of "remove(object)" on ToManyList

From: Kevin Menard (kmenar..ervprise.com)
Date: Tue May 29 2007 - 23:20:51 EDT

  • Next message: Andrus Adamchik: "Re: Mapping to Mysql TEXT type"

    > -----Original Message-----
    > From: Andrus Adamchik [mailto:andru..bjectstyle.org]
    > Sent: Thursday, May 24, 2007 5:52 AM
    > To: use..ayenne.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
    



    This archive was generated by hypermail 2.0.0 : Tue May 29 2007 - 23:21:30 EDT