Addings Objects to a To-Many Relationship

From: Gary Jarrel (garyjarre..mail.com)
Date: Thu Jul 29 2010 - 05:46:28 UTC

  • Next message: Andrey Razumovsky: "Re: Addings Objects to a To-Many Relationship"

    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



    This archive was generated by hypermail 2.0.0 : Thu Jul 29 2010 - 05:47:02 UTC