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

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

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

    On 3/5/08 11:07 AM, "Mike Kienenberger" <mkienen..mail.com> wrote:

    > What happens if you call
    >
    > painting.setArtist(artist);
    > painting.setArtist(artist);
    >
    > If that doesn't give the same results as
    >
    > artist.addToPaintingArray(painting);
    > artist.addToPaintingArray(painting);
    >
    > then I would say it's a bug just due to the inconsistency.

    I just added another test case to test that. Indeed, the list count is just
    1.

    > Since we're not working with only abstract list concepts here, but are
    > using lists to model relationships, my opinion would be that having
    > the same object show up in the relationship list twice just because
    > you identified the relationship twice is a bug.

    I agree.

    > For what use case would having the object show up twice be desired behavior?

    The only two things I can think of are:

    1) Maintaining list semantics -- in general, I think the behavior is
    correct, I just don't think it is for Cayenne.

    2) Avoiding overhead -- list membership could be a costly operation. This
    could be reduced by comparing by identity and/or ObjectId, however, which
    should be fast enough.

    -- 
    Kevin
    



    This archive was generated by hypermail 2.0.0 : Wed Mar 05 2008 - 11:17:25 EST