On 3/5/08 11:07 AM, "Mike Kienenberger" <[EMAIL PROTECTED]> 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

Reply via email to