• 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: Cascading Deletes in WO and DB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cascading Deletes in WO and DB


  • Subject: Re: Cascading Deletes in WO and DB
  • From: Chuck Hill <email@hidden>
  • Date: Fri, 8 Jun 2007 10:06:35 -0700


On Jun 8, 2007, at 9:45 AM, David Avendasora wrote:

Ken and Chuck,

Thanks for the input. I have the delete rules set in the DB out of habit. I usually make changes to the DB first, then to WO (as opposed to generating SQL out of EOModeler) and it helps remind me to setup the EOModel correctly. It had just occurred to me that it may cause conflicts, but I suppose if the SQL executed for the delete simply returns "0 record(s) affected" WO will simply look at that as "Not an error" and continue on.

But I can see a HUGE danger if the EOModel and DB are NOT in perfect agreement on the cascading deletes as things could get deleted in the DB without WO knowing which I'm sure could cause all sorts of crazy, difficult to diagnose problems.

Yes, the danger is the DB having cascades that are not in the model. It won't cause your app to explode, but you will get exceptions when EOF tries to read/update/delete the objects that were deleted behind its back. This is essentially the same case as where another instance of your WO app has deleted them so it needs to be accommodated anyway.


Chuck



On Jun 8, 2007, at 11:28 AM, Ken Anderson wrote:

David,

Is there a reason you have them in your DB? It's far safer to implement the cascade deletes in WO so you don't have to worry about your object graph and the database getting out of sync.

To answer your question, the DB or WO will win at different times because of the order of operations generated from WO. I don't think it will be a problem though, since I don't believe WO cares if the number of deleted rows fails to match the number of deleted objects.

Ken

On Jun 8, 2007, at 11:57 AM, David Avendasora wrote:

Hi all,

I have a question regarding the best place to handle cascading deletions. Right now both my database (MS SQLServer) and my EOModel have cascading deletes defined on several relationships. The EOModel and database mirror each other's cascade settings.

Is this going to confuse WO if it goes to delete a related object only to find that the DB has already deleted it (I'm assuming that the database will have deleted the related record before WO gets around to it)?

Thanks,

Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40anderhome.com


This email sent to email@hidden




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net


This email sent to email@hidden


--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Cascading Deletes in WO and DB (From: David Avendasora <email@hidden>)
 >Re: Cascading Deletes in WO and DB (From: Ken Anderson <email@hidden>)
 >Re: Cascading Deletes in WO and DB (From: David Avendasora <email@hidden>)

  • Prev by Date: Re: Cascading Deletes in WO and DB
  • Next by Date: Problem with deleting a related object (to-many relationship)
  • Previous by thread: Re: Cascading Deletes in WO and DB
  • Next by thread: Re: Cascading Deletes in WO and DB
  • Index(es):
    • Date
    • Thread