Re: coredata batch fault/prefetch relationships
Re: coredata batch fault/prefetch relationships
- Subject: Re: coredata batch fault/prefetch relationships
- From: Aurélien Hugelé <email@hidden>
- Date: Tue, 24 Jan 2006 17:12:02 +0100
Core Data does not support relationships batch faulting :
Features Supported Only by EOF
EOF allows you to use custom SQL, shared editing contexts, and nested
editing contexts. Core Data does not provide the equivalent of an
EOModelGroup—the NSManagedObjectModel class provides methods for
merging models from existing models, and for retrieving merged models
from bundles.
EOF supports pre-fetching and batch faulting of relationships, Core
Data does not.
too bad :(
On 24 janv. 06, at 15:21, Jesse Grosjean wrote:
I'm sorry if these questions are already answered in the
documentation (Core Data Programming Guide: Fetching Managed
Objects), I'm just having a hard time putting it all together.
I have a tree structure in core data and I'm trying to figure out
the best way to pre-fetch the entire structure along with all
relationships (except for the valueHolder relationship). My tree
structure consist of lightweight Nodes entities. The nodes don't
have any attributes, but they do have three relationships:
Node
parent (to one relationship to Node)
children (to many relationship to Node)
valueHolder (to one relationship where actual values are stored)
The first thing that I do is try to batch fault all Node entities
using this code from the Core Data Programming Guide.
[fetchRequest setEntity:[NSEntityDescription entityForName:@"Node"
inManagedObjectContext:moc]];
fetchResults = [moc executeFetchRequest:fetchRequest
error:&fetchError];
[fetchRequest setPredicate:[NSPredicate predicateWithFormat:@"self
IN %@", fetchResults]];
[moc executeFetchRequest:fetchRequest error:&fetchError];
But that still leaves all the relationships in the fault state, and
firing the faults on the parent and children relationships is a big
performance problem. If I add the following two lines to the above
code my application will run fast after the two lines have
executed, but executing these two lines takes a very long since
I've just manually firing the relationship faults.
[fetchResults valueForKey:@"parent"];
[[fetchResults valueForKey:@"children"] valueForKey:@"parent"];
So my big question is how to I pre-fetch these relationships
efficiently? The Pre-fetching example in the documentation looks
like it's pre-fetching the destination objects, but not the
relationship. In my case the destination objects have already been
fetched, but the relationship between the source and destination is
still faulted. Is it possible to also pre-fetch those relationships?
Thanks,
Jesse
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gumitech.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden