Re: [jira] Created: (CAY-1000) Duplicate items in list.

From: Kevin Menard (kmenar..ervprise.com)
Date: Wed Mar 05 2008 - 11:32:24 EST

  • Next message: Andrus Adamchik: "Re: [jira] Created: (CAY-1000) Duplicate items in list."

    On 3/5/08 11:19 AM, "Andrus Adamchik" <andru..bjectstyle.org> wrote:

    > 1. Cayenne only guarantees that *Cayenne* will return no duplicates
    > for to-many. If a user explicitly wants a list to contain duplicates,
    > that's his problem.

    I don't think anyone wants to have duplicates. That's probably the largest
    issue at hand. End user error or not, does it even really make sense? If
    not, how can the framework help? Telling everyone to do duplicate checks on
    all tomany relationships for all entities is a bit of a bummer.

    FWIW, I had actually tried to address this globally by extending
    CayenneDataObject and making my class hierarchy extend from that. I ended
    up having a set of other problems, per my thread on the user list the other
    day. I think they were related to the direction in which the list was being
    modified, but I didn't dig into it long enough to verify. The point being
    more that this could be hazardous and open us up to supporting other harder
    problems to solve.

    > 2. If the user wants the framework to ensure no duplicates, no matter
    > what, he should use a Set.

    I have yet to map a relationship as a Set. Does the set implementation used
    preserve iteration order?

    If so, I'd advocate this being the default rather than List. Then, if
    someone is worried about performance or random access, he can explicitly
    choose the List. Otherwise, data integrity is the default.

    > (and I agree - let's change the docs to make it more clear)

    Will do.

    -- 
    Kevin
    



    This archive was generated by hypermail 2.0.0 : Wed Mar 05 2008 - 11:35:39 EST