• 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
Problem with locking and deleting with many-to-many relationship
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Problem with locking and deleting with many-to-many relationship
      • From: Art Isbell <email@hidden>
    • Re: Problem with locking and deleting with many-to-many relationship
      • From: Ricardo Strausz <email@hidden>
    • Re: Problem with locking and deleting with many-to-many relationship
      • From: Chuck Hill <email@hidden>
  • Prev by Date: Re: JavaClient, SWT, Eclipse and WO
  • Next by Date: Re: SSL: images not appearing
  • Previous by thread: BATCH UPDATE.
  • Next by thread: Re: Problem with locking and deleting with many-to-many relationship
  • Index(es):
    • Date
    • Thread