• 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
Re: Associate ON DELETE CASCADE with a foreign key
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Associate ON DELETE CASCADE with a foreign key


  • Subject: Re: Associate ON DELETE CASCADE with a foreign key
  • From: Art Isbell <email@hidden>
  • Date: Tue, 25 Feb 2003 08:48:57 -1000

On Tuesday, February 25, 2003, at 05:14  AM, Jacky Gagnon wrote:

What do you think about associate with a foreign key the clause ON DELETE CASCADE (in DB Level)?

What are the problems with WebObjects and EditingContext, if I use this clause in the DB?

This will result in the editing context no longer having a consistent view of the data in the database. I.e., the editing context will still contain an object that has been deleted by the cascade rule in the database.


But this is no different from what would happen if any other process deleted the same object. EOF should deal with this correctly if you have implemented optimistic locking correctly. However, any attempt to update or delete this object will result in an optimistic locking failure exception being thrown when the editing context is sent a saveChanges() message. It's almost always preferable to prevent rather than handle exceptions when possible as it should be in this case.

I try to find another way for deleting rows with WO, because fetching rows before deleting is slow, very slow...

Using ON DELETE CASCADE with foreign key seem to be the simplest way for me.

You should be able to do the same thing in your eomodel by setting the appropriate relationship's Delete rule to "Cascade". Then when the source object is deleted, all of the relationship's destination objects will be deleted both from the editing context but also the database.


Art
http://homepage.mac.com/aisbell/
_______________________________________________
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: 
 >Associate ON DELETE CASCADE with a foreign key (From: Jacky Gagnon <email@hidden>)

  • Prev by Date: Auto fill field
  • Next by Date: Re: EOModeler and other databases than Oracle
  • Previous by thread: Associate ON DELETE CASCADE with a foreign key
  • Next by thread: Auto fill field
  • Index(es):
    • Date
    • Thread