• 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: questions about SharedEditingContext
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: questions about SharedEditingContext


  • Subject: Re: questions about SharedEditingContext
  • From: Art Isbell <email@hidden>
  • Date: Wed, 20 Jul 2005 10:19:15 -1000

On Jul 20, 2005, at 8:56 AM, Helen He wrote:

Although I have searched internet for info and read some docs,

If you haven't done so, consider reading <http:// developer.apple.com/documentation/LegacyTechnologies/WebObjects/ WebObjects_4.5/System/Documentation/Developer/WebObjects/DeltaDoc/ EOF.html#CBGCHAIA> (<http://tinyurl.com/a3meb>).


1. From the doc, it says 'Since shared editing contexts listen for ObjectsChangedInStoreNotifications, the shared editing context updates when it learns that an object was modified'. Does that also mean if the database records changed by other applications, the shared editing context will get the notification too.

No.

If it is not, then how the application can detect something has been changed in external data store?

Only when a change has been made in the same process will a shared editing context and all other editing contexts in that process as well be notified. This is no different from the behavior of all editing contexts.


2. Does the SharedEditingContext only work with the fetchSpecifications which are pointed by either 'Share all objects' or 'Share objects fetched with' options in Shared Object Inspector OR it can work with any regular fetchSpecifications?

A shared editing context can use any fetch specification programmatically, but those entities designated in an eomodel to "Share all objects" or "Share objects fetched with" will be fetched automatically into the default shared editing context.


3. After shared EO objects are loaded into sharedEditingContext at Application level, how can we retrieve the data that is already in sharedEditingContext at each page ?

The EOSharedEditingContext JavaDoc states:

"Objects can be fetched into a shared context using objectsWithFetchSpecification and bindObjectsWithFetchSpecification. The latter method makes it easier to access result sets, using objectsByEntityNameAndFetchSpecificationName."

objectsByEntityName() can also be used. Or you can store them in Application instance variables accessed by public Application methods. If you do so, a resource is being shared among sessions, so accessor methods should be synchronized to make access thread-safe.

4. Is that 'new EOEditingContext().sharedEditingContext()' is same as 'EOSharedEditingContext.defaultSharedEditingContext()'? If it is not, how can we get the same object of EOSharedEditingContext as in the application level, which will be used to get objects in each session or in each page?

The shared editing context of all editing contexts is the default shared editing context. editingContext.sharedEditingContext () and EOSharedEditingContext.defaultSharedEditingContext() will return the same shared editing context unless you have explicitly set an editingContext's shared editing context to a different shared editing context.


5. Does anybody find any memory issue with using EOSharedEditingContext?

A shared editing context can use more memory if you fetch objects into it that aren't needed by your app. But if you're careful to fetch only those objects likely to be used by your app, the instantaneous memory usage might be less than that when no shared editing context were used because the same objects won't be fetched into multiple editing contexts. The average memory usage over the life of the process might be similar with a shared editing context because shared objects always exist. So I don't see memory usage as a shared object advantage or disadvantage, but I've never done a comparison.


Shared editing context advantages are reduced database access and no need to create local instances of shared objects in other editing contexts.

Only those objects that will never be source objects in relationships with unshared destination objects can be shared. Shared objects should be read-mostly as well because updating them requires a special procedure.

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


References: 
 >questions about SharedEditingContext (From: Helen He <email@hidden>)

  • Prev by Date: Re: questions about SharedEditingContext
  • Next by Date: Using &amp; instead of & in WOHyperlink
  • Previous by thread: Re: questions about SharedEditingContext
  • Next by thread: Re: Webobjects-dev Digest, Vol 2, Issue 413
  • Index(es):
    • Date
    • Thread