Re: Core data - getting fresh records
Re: Core data - getting fresh records
- Subject: Re: Core data - getting fresh records
- From: Steve Steinitz <email@hidden>
- Date: Thu, 27 Sep 2007 16:31:04 +1000
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:
This email sent to email@hidden