Re: Problem with locking and deleting with many-to-many relationship
Re: Problem with locking and deleting with many-to-many relationship
- Subject: Re: Problem with locking and deleting with many-to-many relationship
- From: Art Isbell <email@hidden>
- Date: Wed, 26 Nov 2003 12:31:37 -1000
On Nov 26, 2003, at 10:50 AM, Gerald Hanks wrote:
I have a flattened many-to-many relationship from item to option which
uses
three tables: item, option, and item_option. The item object has a
flattened
attribute called options.
If you didn't ask EOModeler to build this many-to-many relationship,
you might try doing so because building one manually is difficult to do
correctly.
When I add an option to the options list using
anItem.addToOptions(anOption) I get the following SQL on saveChanges()
When I remove an option from the options list using
anItem.removeFromOptions(anOption) then I get the following SQL on
saveChanges()
Generally, atItem.addObjectToBothSidesOfRelationshipWithKey("options")
and anItem.removeObjectFromBothSidesOfRelationshipWithKey("options")
should be used. These invoke addToOptions() and removeFromOptions(),
respectively, but they also correctly manage the inverse relationship,
Option.items.
Aloha,
Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.