Re: Addings Objects to a To-Many Relationship

From: Andrey Razumovsky (razumovsky.andre..mail.com)
Date: Thu Jul 29 2010 - 05:55:37 UTC

  • Next message: Andrey Razumovsky: "Re: Sorting of to many relation Lists"

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



    This archive was generated by hypermail 2.0.0 : Thu Jul 29 2010 - 05:56:30 UTC