Re: How do I know when an EOEnterpriseObject is removed from an Editi ng Context?
Re: How do I know when an EOEnterpriseObject is removed from an Editi ng Context?
- Subject: Re: How do I know when an EOEnterpriseObject is removed from an Editi ng Context?
- From: Chuck Hill <email@hidden>
- Date: Wed, 08 Jan 2003 16:50:05 -0800
That won't work reliably either. If another object fails its validation or
the DB update fails then you have done something you did not need / want to
do. The only reliable way to do this is with an EOEditingContext subclass
or delegate that messages the EO objects once an operation has completed.
There is such a delegate in Project Wonder, and both solutions have been
discussed on the list in the past.
Chuck
At 06:41 PM 08/01/2003 -0600, Alex Johnson wrote:
>>>>
Instead of trying to find this hook you could set a flag in
awakeFromInsertion and then execute the custom SQL in validateForSave() if
the flag is set. That way, the SQL doesn't get executed until the object
is actually saved in the database...
Alex Johnson
-------------------------------
Site9 Internet Business Solutions :: Chicago, IL
email@hidden
On Wednesday, January 8, 2003, at 06:22 PM, MacMullin, Jake (DCS) wrote:
Hi,
I need to do some database manipulation with raw SQL when my objects are
created - so I have overridden awakeFromInsertion to write some stuff to the
DB when my objects are inserted into an editing context. I also need to do
some cleaning up if the object is deleted - so I have overridden
validateForDelete to use raw SQL to delete the stuff from the database. This
works beautifully. Whenever I create an object it writes the stuff I want to
the DB and when it is deleted it cleans up after itself.
However, I have stumbled across a problem. What do I do if the object is
created and inserted in to the editing context, but then the changes are
discarded, like if the 'Cancel' button is pressed in a Direct2Web app or by
revert() being called on the editing context. It seems like the
validateForDelete method isn't called in this case. So how do I know when
one of my custom EOEnterpriseObjects is discarded in this manner?
Regards,
Jake MacMullin
This e-mail is personal. It is not authorised by, nor sent on behalf of, the
Government of South Australia.
_______________________________________________
WebObjects-dev mailing list
email@hidden
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
<<<<
_______________________________________________
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.