• 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: Deleting with Referential Integrities
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Deleting with Referential Integrities


  • Subject: Re: Deleting with Referential Integrities
  • From: Florijan Stamenkovic <email@hidden>
  • Date: Mon, 27 Jun 2005 13:31:00 +0200


On Jun 27, 2005, at 06:18, Greg wrote:

I have an Entity Album that has a to-many relationship to Image. The album also has a relationship to Image as an Icon. When it comes time to delete the image that is the icon for the album, I get the operation failing as it would violate the referential integrity of the album. What I tried to do was intercept if the image about to be deleted was an icon and if so create a different editing context, and set the albums icon to null (something that is allowed),

So, Album has a foreign key and a relationship called Icon pointed to the Image table. If you delete an Image that is an Icon, you get a crooked result. If you have a relationship Image >> Albums (from pk in Image to the fk used for the Icon relationship), why don't you just set the delete rule to nullify (as the inverse relationship called Icon (Album>Image) is not mandatory)? So, you are free to delete whatever you like.


then save this context, force the other context to refault the album and then delete the image. This too fails. I'm at a loss as to what to do in this sort of circumstance.

Any help is greatly appreciated.

So: forget about the "deny" integrity rule, upon deletion check to see if an image is an Icon for a certain album. If yes, warn (if you like), and just delete it. But maybe I didn't understand your problem correctly.
.

Regards, Greg

Cheers Flor

_______________________________________________
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


  • Follow-Ups:
    • Re: Deleting with Referential Integrities
      • From: Greg <email@hidden>
References: 
 >Deleting with Referential Integrities (From: Greg <email@hidden>)

  • Prev by Date: Strings and the Properties file
  • Next by Date: Deployment on linux
  • Previous by thread: Deleting with Referential Integrities
  • Next by thread: Re: Deleting with Referential Integrities
  • Index(es):
    • Date
    • Thread