Problem with locking and deleting with many-to-many relationship
Problem with locking and deleting with many-to-many relationship
- Subject: Problem with locking and deleting with many-to-many relationship
- From: Gerald Hanks <email@hidden>
- Date: Wed, 26 Nov 2003 13:50:39 -0700
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.