• 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: Nested Editing Contexts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nested Editing Contexts


  • Subject: Re: Nested Editing Contexts
  • From: Chuck Hill <email@hidden>
  • Date: Mon, 21 Jul 2003 17:53:03 -0700

Unrelated to your question (which was already answered), lock your editing
contexts!

ec = session().defaultEditingContext();
nestedEc = new EOEditingContext(ec);
nestedEc.lock();

try {
    EOEnterpriseObject eo = new EOEnterpriseObject();
    nestedEc.insertObject(eo);

    // user updates eo and clicks save

    nestedEc.saveChanges();
    ec.saveChanges();
}
finally {
    nestedEc.unlock();
    nestedEc = null;  // Or don't use it again withouth locking again
}


Chuck



At 05:29 PM 21/07/2003 -0500, Albert Jagnow wrote:
>I have changed the application I am currently working on to use nested
>editing contexts based on some earlier discussion that it might be a
>better/safer way of doing things.  A very simple description of what I
>have is like the following:
>
>ec = session().defaultEditingContext();
>nestedEc = new EOEditingContext(ec);
>
>EOEnterpriseObject eo = new EOEnterpriseObject();
>nestedEc.insertObject(eo);
>
>user updates eo and clicks save
>
>nestedEc.saveChanges();
>ec.saveChanges();
>
>When ec.saveChanges() is called I get the error "Cannot obtain globalId
>for and object which is registered in an other than the
>databaseContext's active editingContext,..."  I assume I am not
>understanding some simple concept about how nested editing contexts
>should work.  Could someone attempt to explain to me what I am doing
>wrong.
>
>--Albert
>
>
>This e-mail (including any attachments) is covered by the Electronic
>Communications Privacy Act, 18 USC. 2510-2521. It is confidential and
>may be legally privileged. If you are not the intended recipient, you
>are hereby notified that any retention, dissemination, distribution, or
>copying of this communication is strictly prohibited. Please reply to
>the sender that you have received the message in error, and then delete
>it. Thank you.
>_______________________________________________
>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.
>

--

Chuck Hill                                 email@hidden
Global Village Consulting Inc.             http://www.global-village.net
_______________________________________________
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.

  • Prev by Date: concurrency and sessions
  • Next by Date: Re: Can't modify EO objects! ARGH! =(
  • Previous by thread: Re: Nested Editing Contexts
  • Next by thread: concurrency and sessions
  • Index(es):
    • Date
    • Thread