• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Modifying intermediate table in Many-To-Many relationship
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modifying intermediate table in Many-To-Many relationship


  • Subject: Re: Modifying intermediate table in Many-To-Many relationship
  • From: Mark Morris <email@hidden>
  • Date: Fri, 3 Feb 2006 12:58:03 -0600

Hello John,

This isn't a problem, but you can't use the flattened many-to-many relationship. Delete that from your model. Create the AccountStore object manually, and associate it with the Account and Store objects with 2 addObjectToBothSidesOfRelationshipWithKey statements. Set your value in AccountStore. Everything will be saved at the same time.

The flattened many-to-many is cool, but if you have a value in the intermediate table, then it's an object in its own right.

Regards,
Mark


On Feb 3, 2006, at 12:10 PM, John Huss wrote:

I have a many-to-many relationship like this:

Account -> AccountStore -> Store

When I add a store to an account with addObjectToBothSidesOfRelationshipWithKey (via the magic of many-to- many relationships) the object representing the intermediate table does not get created in memory. It only is accessible after everything has been saved and refetched.

So when I examine it, account.accountStores() is empty.

I need to set a value in this intermediate table, preferably at the same time everything else is saved.

I can set up all the relationships manually to make sure everything is correct in memory, but then when I go to save, it tries to create TWO rows in the intermediate table causing a primary key violation.

Any ideas about the best way to do this?

John
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40onpointsoftware.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >File download question (From: Amedeo Mantica <email@hidden>)
 >Re: File download question (From: Miguel Arroz <email@hidden>)
 >Re: File download question (From: Amedeo Mantica <email@hidden>)
 >Re: File download question (From: John Andersson <email@hidden>)
 >Re: File download question (From: Amedeo Mantica <email@hidden>)
 >Modifying intermediate table in Many-To-Many relationship (From: "John Huss" <email@hidden>)

  • Prev by Date: Modifying intermediate table in Many-To-Many relationship
  • Next by Date: Master-Detail edit page
  • Previous by thread: Modifying intermediate table in Many-To-Many relationship
  • Next by thread: Deployment on Solaris 10 / SPARC
  • Index(es):
    • Date
    • Thread