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



The FOR UPDATE looks suspicious.  Two things to check very carefullly:

- value types in model
- relationship definitions and flattened properties in the model

Mistakes in the model can make EOF crazy.  :-)

Chuck


At 01:50 PM 26/11/2003 -0700, 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.
>

--

Chuck Hill                                 email@hidden
Global Village Consulting Inc.             http://www.global-village.net
_______________________________________________
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.