Re: Deleting with Referential Integrities
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