Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with locking and deleting with many-to-many relationship



If not an answer, some point to check:
- are you using add/deleteToBothSidesOfRelation?
- are your model delete rules correct?
- did you *log* the EC's arrays updatedObjects, deletedObjects and so? if so, is that what you spected to be?
- are you using pessimistic locking?
Dino


On Nov 26, 2003, at 14:50, 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.


When I add an option to the options list using

anItem.addToOptions(anOption) I get the following SQL on saveChanges()

INSERT INTO item_option(item_id, option_id) VALUES (1, 8)

This would seem to be correct

When I remove an option from the options list using

anItem.removeFromOptions(anOption) then I get the following SQL on saveChanges()

SELECT t0.item_id FROM item_option t0 WHERE t0.option_id = 8 FOR UPDATE
DELETE FROM item_option WHERE option_id = 8

This seems to be in error since this SQL would remove option 8 from all items not
just the one being updated. In fact if there are two items with option 8 and
I try to delete option 8 from either item I get a locking failure telling me
that more than one row was locked.


Can anyone help me on this one.  I am kind of stuck for the time being.

-gerald
_______________________________________________
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.
_______________________________________________
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.

References: 
 >Problem with locking and deleting with many-to-many relationship (From: Gerald Hanks <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.