• 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: Object registered within another EditingContext
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Object registered within another EditingContext


  • Subject: Re: Object registered within another EditingContext
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 12 Oct 2017 18:43:34 +0000
  • Thread-topic: Object registered within another EditingContext

localInstance is the correct answer.

Chuck

From: Webobjects-dev
<webobjects-dev-bounces+chill=email@hidden> on behalf of
Theodore Petrosky <email@hidden>
Date: Thursday, October 12, 2017 at 11:42 AM
To: André Rothe <email@hidden>
Cc: WebObjects-Dev <email@hidden>
Subject: Re: Object registered within another EditingContext

I don’t know if this could help but, in the generated code of an entity is a
method:  (localInstanceIn)

  public com.eltek.model.Person localInstanceIn(EOEditingContext
editingContext) {
    com.eltek.model.Person localInstance =
(com.eltek.model.Person)EOUtilities.localInstanceOfObject(editingContext, this);
    if (localInstance == null) {
      throw new IllegalStateException("You attempted to localInstance " + this
+ ", which has not yet committed.");
    }
    return localInstance;
  }

of course you could create a new entity in your new editingContext and copy
over the attributes, or as you suggest fetch the entity again (in the new
editingContext).

I would look for what has the least keystrokes.

Ted

On Oct 12, 2017, at 2:23 PM, André Rothe
<email@hidden<mailto:email@hidden>> wrote:

Hi,

I have insert an object into the default EditingContext (from session). Then I
have created a thread with a new EditingContext to insert a lot of detail
records, which have a reference to the first inserted record. WebObjects says
now:

Cannot obtain globalId for an object which is registered in an other than the
databaseContext's active editingContext

It is clear, that the first record is registered within the default
EditingContext and not in my second EC. Can I register the object on the latter
EC or should I simply fetch the record again?

Thank you
Andre
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list
(email@hidden<mailto:email@hidden>)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


 _______________________________________________
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

References: 
 >Object registered within another EditingContext (From: André Rothe <email@hidden>)
 >Re: Object registered within another EditingContext (From: Theodore Petrosky <email@hidden>)

  • Prev by Date: Re: Object registered within another EditingContext
  • Next by Date: Re: Wonder upgrade 6 to 7
  • Previous by thread: Re: Object registered within another EditingContext
  • Next by thread: Re: Object registered within another EditingContext
  • Index(es):
    • Date
    • Thread