Your problem is that objects are uniqued within their editing context and an
instance CANNOT be in more than one editing context.

What you are supposed to do is fault in the global object into your session's
editing context during the set "shared" object.

Java:
someSessionEO.setSomeSharedObject(EOUtilities.localInstanceOfObject(session().defaultEditingContext(),
sharedObject));

In WebScript:

[someSessionEO setSomeSharedObject: [[[self session] defaultEditingContext]
localInstanceOfObject: sharedObject]];

NOTE: You need to be VERY VERY careful with global editing contexts.  This is
because editing contexts should be locked to avoid threading conflicts during
your request/response cycle.  WebObjects automatically locks/unlocks your
session's defaultEditingContext so you usually dont need to think about this.
But you do need to think about locking/unlocking the global editing context to
be thread safe.

-dave


"Pogrebitskiy, Boris" wrote:

> > -----Original Message-----
> > From: Pogrebitskiy, Boris
> > Sent: Wednesday, March 03, 1999 11:28 AM
> > To:   '[EMAIL PROTECTED]'
> > Subject:      Sharing objects from multiple EOEditingContexts
> >
> > I have data that l fetch only once for all sessions on Application level.
> > In order to fetch it I create new EOEditingContext.
> > As a result all objects will be stored on Application level inside of
> > created EditingContext.
> >
> > Custom objects created inside of a session can access objects created on
> > Application level, but this objects belong to different editingContext.
> > If I try to set "shared" object to attribute of my custom object created
> > on session level - it works, but if I try to save session editingContext -
> > NSInternalInconsistencyException :
> >
> >  _globalIDForObject:: EODatabaseContext 0x34045f0 unable to obtain global
> > id for OrganizationLevel object 0x3408620 from EOEditingContext 0x340f0a0
> >
> >
> > Based on documentation I can setParentObjectStore and it should work, but
> > it doesn't. Looks like this two editingContexts are not sharing
> > EODatabaseContext.
> >
> > - I know this is a task that some of you did many times and I just doing
> > something wrong. May be you can help me to find a problem...
> >
> > Thank you.

Reply via email to