Re: SharedEditingContext Write Locks?
Re: SharedEditingContext Write Locks?
- Subject: Re: SharedEditingContext Write Locks?
- From: Lachlan Deck <email@hidden>
- Date: Thu, 17 Nov 2005 15:36:59 +1100
Hi again,
On 17/11/2005, at 2:36 PM, Dov Rosenberg wrote:
So if I understand what you are saying here
They work best by using their API to fetch objects you wish to share
into the context, and then creating real EOEditingContexts and having
them use that shared context.
If I want to use shared objects from a non shared editing context I
need to
set the shared ec
SharedEc = EOSharedEditingContext.defaultSharedEditingContext();
EOEditingContext ec = new EOEditingContext ();
ec.setSharedEditingContext(SharedEc);
By setting the Shared EditingContext into my regular one, do I now get
automatic access to the shared objects stored within?
So if I do something like
ec.objectsWithFetchSpecification(....)
And the objects had been previously retrieved by the SharedEC -
would ec be
able to use them?
sounds like it... I've not tried it.
[If I'm reading between the lines it looks like you're thinking about
in-memory fetching (saving the db round-trip)]
SharedEC API:
"It is possible to modify shared objects while an application is
running, but only indirectly. A regular editing context can be
created that doesn't share objects by setting it's
sharedEditingContext to null."
EC API:
"If one of these objects is already present in memory, this method
doesn't overwrite its values with the new values from the database.
This method throws a RuntimeException if an error occurs; the error
message indicates the nature of the problem."
So consider those objects (and any related to shared objects) read-
only unless you've faulted them into a non-shared EC.
See
"Working With Objects in Multiple Editing Contexts" in
http://developer.apple.com/documentation/WebObjects/
Enterprise_Objects/index.html
with regards,
--
Lachlan Deck
_______________________________________________
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