Re: SharedEditingContext Write Locks?
Re: SharedEditingContext Write Locks?
- Subject: Re: SharedEditingContext Write Locks?
- From: Ben Trumbull <email@hidden>
- Date: Thu, 17 Nov 2005 12:03:12 -0800
At 10:11 PM -0500 11/16/05, Dov Rosenberg wrote:
We changed the code to do something like this instead:
fetchedRecords = ec.objectsWithFetchSpecification(fetchSpec);
Where ec is our SharedEditingContext. Is that the correct usage?
Yes.
Is it safe to assume that if the SharedEditingContext does not contain the
data it will retrieve it.
Yes.
And if it does contain the data that it will use it instead of
re-fetching from the DB?
No. objectsWithFetchSpecification() will always go back to the database.
Since you ought to preopopulate the shared EC, this shouldn't be a problem.
You can use the other API on the shared EC to get currently known
shared objects by entity or fetch spec without hitting the database.
<even more advanced stuff here>
However, if you need to add objects to the shared EC, and you know
they are already cached in the database row cache, you can fault them
into the shared EC just like a regular EC. In this scenario, I would
use the same locking code I wrote about earlier (sharedEC + object
store coordinator) around the faulting. I would also explicitly trip
the fault within that lock scope.
</even more advanced stuff here>
What is the purpose of the "Share all objects" checkboxes in the EOEntity in
EOModeler?
You can set fetch specifications to automatically populate the
default shared EC for these entities.
Does EOF fetch these things into the SharedEditingContext automatically?
Yes.
Is it related to the "Cache objects" check box?
No, this is a completely different (and older) feature than
EOSharedEditingContext. It shares the data at the row level in the
object store coordinator (or most precisely the EODatabase row
cache). It basically prepopulates your row cache for those entities
and also evaluates queries against those entities in memory.
We have a bunch of data that is static (lookup codes, etc) that are used in
relationships to other EOs that are not static. Can we fetch the lookupCodes
into the SharedEditingContext and make use of them in the regular editing
contexts?
Absolutely.
--
-Ben
_______________________________________________
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