preventing orphan records - where is best place
preventing orphan records - where is best place
- Subject: preventing orphan records - where is best place
- From: Kieran Kelleher <email@hidden>
- Date: Wed, 29 Oct 2008 18:15:58 -0400
I have a scenario where I have EO's in many-to-many .... A <<-->> B.
The delete rule is nullify when A is deleted. A is the important EO
and generally one A is related to a whole lot of B's.
Now if the B was only related to the A being deleted, then those
related B's should be deleted, as if we were cascade deleting, and not
delete any B's that are related to other A's should not be deleted.
Now what I did was use the ERXEnterpriseObject#willDelete()
EOTransition method to grab the related B's as immutable clone and
iterate thru them, however by the time I get to willDelete the related
B's relationship are already nullified and thus the relationship
returns an empty array and the B orphans are already in the wild.
For now I am over-riding ERXGenericRecord#delete() and doing it there
after super.delete(), but I really wanted a more robust solution that
will catch the future orphans when the more standard
editingContext.deleteObject(EO o) is used.
Any suggestions?
_______________________________________________
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