cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrey Razumovsky <razumovsky.and...@gmail.com>
Subject Re: Addings Objects to a To-Many Relationship
Date Thu, 29 Jul 2010 05:55:37 GMT
Hi,

This is List after all :) You can use Set or Map as collection type if
adding same objects to list is important

2010/7/29 Gary Jarrel <garyjarrel@gmail.com>

> Hi All
>
> I've noticed something interesting and although it seems trivial from
> the outset, I am not sure why this happens:
>
> MarketingCampaign campaign =
> DataContext.getThreadObjectContext().newObject(MarketingCampaign.class);
> MarketingCampaignProduct pT1 =
>
> DataContext.getThreadObjectContext().newObject(MarketingCampaignProduct.class);
>
> campaign.addToMarketingCampaignProducts(pT1);
> campaign.addToMarketingCampaignProducts(pT1);
>
> assertEquals(1, campaign.getMarketingCampaignProducts().size());
>
> I would have though that adding the same object to the list would not
> make the list grow however my assert fails because the list appears to
> be of size 2 instead of 1.
>
> Perhaps I am missing something here?
>
> Thank you
>
> Gary
>



-- 
Andrey

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message