• 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: How to delete an EO?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: How to delete an EO?
      • From: Bill Reynolds <email@hidden>
    • Re: How to delete an EO?
      • From: Chuck Hill <email@hidden>
References: 
 >Re: How to delete an EO? (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: How to delete an EO?
  • Next by Date: Re: How to delete an EO?
  • Previous by thread: Re: How to delete an EO?
  • Next by thread: Re: How to delete an EO?
  • Index(es):
    • Date
    • Thread