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

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Mar 05 2008 - 11:52:56 EST

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

    On Mar 5, 2008, at 6:32 PM, Kevin Menard wrote:

    > I don't think anyone wants to have duplicates. That's probably the
    > largest
    > issue at hand. Telling everyone to do duplicate checks on
    > all tomany relationships for all entities is a bit of a bummer.

    Why is that a problem? The cases where duplicates could occur should
    be expected by the user. Those are well-defined cases in the
    application, not some obscure side effects of using Cayenne. E.g. I
    always do that, and don't think this is a big deal:

    if(!user.getRoles().contains(role)) {
        user.addToRoles(role);
    }

    That's no different from List.add(..) logically.

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

    No, it is a HashSet.

    > 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.

    -1. The performance impact will be huge.

    > Otherwise, data integrity is the default.

    Data integrity is not compromised. Everything that is saved to the DB
    is correct.

    Andrus



    This archive was generated by hypermail 2.0.0 : Wed Mar 05 2008 - 11:53:40 EST