• 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: Core data - getting fresh records
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core data - getting fresh records


  • Subject: Re: Core data - getting fresh records
  • From: Ian Joyner <email@hidden>
  • Date: Thu, 27 Sep 2007 17:23:19 +1000

I'm having similar problems as to when CD fetches objects. Have you tried NSObjectController.setUsesLazyFetching: NO, assuming you are using bindings that is?

DKITH

Ian

On 27/09/2007, at 4:31 PM, Steve Steinitz wrote:

Thanks for your comments Jerry.  You wrote:

My question is, is there any way, short of writing SQL or doing
[managedObjectContext reset], that I can force a Sales fetch to go
directly to the SQLite database and not use the Sales in memory?

I'm new with Core Data, but intrigued that there is not a simple method to do this. From reading the documentation, though, the following Wild And Crazy Kludge might work:

    (a) setStalenessInterval: to something really small like 10
microseconds
    (b) refreshObject:mergeChanges
    (c) setStalenessInterval: back to 0 (infinite) or whatever it was

I'm worried that if any other objects get involved in step (b) before
(c) is invoked, it might set off a never-ending chain reaction of
fetches, but it might be fun to try!

By my reading, the staleness interval is a false hope and doesn't have much to do with getting fresh values from the persistent store. Here is the somewhat cryptic quote from the doco:

The staleness interval does NOT affect objects currently in use [?]
(that is, it is NOT used to automatically update property values
from a persistent store after a certain period of time).


And besides, refreshObject: mergeChanges doesn't help me find new
objects that have been created behind my back -- which is the gist of
my question.

Having not had a slam-dunk response to this question, I think I may be
reduced to writing SQL -- something I actively avoid.

I did try using [context reset].  It actually worked but it caused so
many side effects (my dozens of array controllers were eventually only
partially filled with data or completely empty) that I recoiled in
fright from that for now.  But I may return to it (maybe mass calls to
[xyzArrayController fetch] would fix them).

Please, if anyone has some experience in this area, I'm all ears.  Mr
Bumgarner?

Cheers,

Steve
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
40sportstec.com


This email sent to email@hidden



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: Core data - getting fresh records (From: Steve Steinitz <email@hidden>)

  • Prev by Date: Re: NSTextField: mystery line drawing outside focus ring?
  • Next by Date: Re: Convenience Methods
  • Previous by thread: Re: Core data - getting fresh records
  • Next by thread: Re: Core data - getting fresh records
  • Index(es):
    • Date
    • Thread