• 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: Generics Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generics Question


  • Subject: Re: Generics Question
  • From: Art Isbell <email@hidden>
  • Date: Thu, 20 Dec 2007 16:43:56 -1000

On Dec 20, 2007, at 2:03 PM, Jonathan Miller wrote:

How do I do the following without getting the pesky warning from Eclipse about unchecked type conversion?

NSArray<NewsKeywords> newsKeywords = EOUtilities.objectsForEntityNamed(EOSharedEditingContext.defaultSharedEditingContext(), "NewsKeywords");

I wouldn't do the above in the first place.  Just because an EOSharedEditingContext extends EOEditingContext doesn't mean that it IS an EOEditingContext.  It's actually quite different and can be the cause of considerable grief when not handled correctly (deadlocks and other nasty behaviors).  It's probably best to fetch shared objects only early in an app's life (e.g., in the Application constructor) or to mark objects as shared in one's eomodel which will cause them all to be fetched when the first shared object is fetched.

NewsKeywords should be fetched into an EOSharedEditingContext using its thread-safe API, objectsWithFetchSpecification() or bindObjectsWithFetchSpecification(), and these fetched objects accessed only using the thread-safe API, objectsByEntityName() or objectsByEntityNameAndFetchSpecificationName().  You may be able to avoid the unchecked type conversion warnings by doing so as well.

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: 
 >Generics Question (From: Jonathan Miller <email@hidden>)

  • Prev by Date: Re: EOModeler: Migration from XCode to WOLips and WO 5.4
  • Next by Date: Change Notification vs New EditingContext vs ?
  • Previous by thread: Re: Generics Question
  • Next by thread: Change Notification vs New EditingContext vs ?
  • Index(es):
    • Date
    • Thread