Re: Memory Management
Re: Memory Management
- Subject: Re: Memory Management
- From: Jeff Schmitz <email@hidden>
- Date: Fri, 06 Mar 2009 22:34:44 -0600
I think I found the answer in a question you answered back in 2006...
prefetchingRelationshipKeyPaths is about pulling in all objects
related to the object(s) being fetched. If you fetch the person and
set prefetchingRelationshipKeyPaths to ("personNames",
"personNames.publications") EOF will make three selects. One for
Person, one for all PersonNames for that Person, and one for the
Publications. The fetch will return the single person object.
Very nice!
Jeff
On Mar 6, 2009, at 9:55 PM, Jeff Schmitz wrote:
On Mar 6, 2009, at 7:05 PM, Chuck Hill wrote:
That is _batch_ fetching, not _pre_fetching. They do similar
things, but prefetching is easier to use for most cases.
I'm working on the prefetching and was wondering, is there any way
to prefetch several "layers" of relationships into the editing
context all in one call? Or can you only go down one layer at a time?
Here's what I've come up with to prefetch all the entries in a pool,
but I would like to be able to specify that all those entries Games
also be pre-fetched (and so on):
public static Pool
fetchPoolWithNameAndPrefetchEntries(EOEditingContext ec, String
name, byte poolType) {
EOQualifier poolQual = Pool.POOL_TYPE.eq(poolType).and(
Pool.NAME.likeInsensitive(name));
ERXFetchSpecification poolFetch = new
ERXFetchSpecification(_Pool.ENTITY_NAME, poolQual, null);
NSArray <String> keyPaths = new NSArray(new String[]
{Pool.ENTRIES_KEY});
poolFetch.setPrefetchingRelationshipKeyPaths(keyPaths);
return (Pool)
ec.objectsWithFetchSpecification(poolFetch).lastObject();
}
_______________________________________________
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
_______________________________________________
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