Re: EOEditingContext in Application
Re: EOEditingContext in Application
- Subject: Re: EOEditingContext in Application
- From: Art Isbell <email@hidden>
- Date: Tue, 01 Jul 2008 11:19:24 -1000
On Jul 1, 2008, at 2:18 AM, Drew Thoeni wrote:
However, in the docs referenced below, it seems to say use something
like this in the session:
public NSArray languageList() {
return
(NSArray
)EOUtilities
.objectsWithFetchSpecificationAndBindings( defaultEditingContext(),
"Language", "FetchAllAvailableLanguages", null);
}
First, EOSharedEditingContext should not be treated as an
EOEditingContext subclass. It just shares a bit of the same API, but
is quite different underneath. If you read the EOSharedEditingContext
docs, you will see warnings against sending any but a few messages to
an EOSharedEditingContext without first locking it. Locking an
EOSharedEditingContext incorrectly or not locking it when it should be
locked will cause serious grief. So it should be used very
carefully. Including it as an argument in
EOUtilities.objectsWithFetchSpecificationAndBindings() is not an
example of careful use.
When the first shared object in an eomodel is fetched, all shared
objects will be fetched automatically. Then you can access these
shared objects from any session by sending the default
EOSharedEditingContext an objectsByEntityName() or
objectsByEntityNameAndFetchSpecificationName() message. You shouldn't
normally have to send the default EOSharedEditingContext an
objectsWithFetchSpecification() method from within a session. Shared
objects are frequently (normally?) fetched in an Application method
early in the app instance's life. These shared objects are then
available for the life of the instance without being refetched.
Updating shared objects can be done, but only with considerable care.
Aloha,
Art
_______________________________________________
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