Re: How to delete an EO?
Re: How to delete an EO?
- Subject: Re: How to delete an EO?
- From: "Glenn L. Austin" <email@hidden>
- Date: Sat, 17 Apr 2004 09:28:17 -0700
on 4/17/04 8:47 AM, Chuck Hill at email@hidden wrote:
> public WOComponent deleteRecord()
> {
> userRecord().editingContext().deleteObject(userRecord());
> userRecord().editingContext().saveChanges();
> return null;
> }
>
> Looks correct to me. Are you getting an exception or error message?
> What happens? If you are not seeing an exception or error then
> something someplace else is wrong.
I see a potential problem. I would code it like this:
public WOComponent deleteRecord()
{
EOEditingContext context = userRecord().editingContext();
context.deleteObject(userRecord());
context.saveChanges();
return null;
}
That way, if the context happens to change due to the deleteObject, the
saveChanges() will continue to work.
--
Glenn L. Austin <><
Computer Wizard and Race Car Driver
<email@hidden>
<http://www.austin-home.com/glenn/>
_______________________________________________
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.