Hello,

I have a WODisplayGroup displayGroup containing a collection of EOs.  The 
entity is registered as a taggable entity, and its tag entity is "TemplateTag", 
a subclass of ERTag.  I want to find the set of all TemplateTags that are 
currently applied to any object in displayGroup.allObjects()—that is, if I 
called tags() on each object in allObjects(), what would be the union of all 
the results (a subset of _all_ TemplateTags)?  And that's literally how I'm 
finding them at the moment: by looping over each EO, calling tags(), and adding 
the result to an NSMutableSet.

This approach seems slow, and, indeed, is resulting in a lot of hits to the 
database.  I've tried calling setPrefetchingRelationshipKeyPaths() on the 
WODisplayGroup's EOFetchSpecification in a couple of ways:

* using the keyPath "tags"—this lead ERProfiling.framework to claim a reduction 
in SQL statements to an acceptable level, but this wasn't reflected in logging 
out the actual SQL.
* attempting to unroll that flattened relationship by using the internal names 
created for the intermediate relationships—this didn't seem to work at all.

I also tried ERXBatchFetchUtilities.batchFetch() on displayGroup.allObjects() 
using both of those key paths.  The first made no difference (to the SQL 
output) and the second failed with an exception.  (In all cases, the majority 
of the SQL statements were SELECTs from the join table.)

I have two questions:

1.  Should I expect to be able to pre-fetch/batch-fetch ERTags like this at all?

2.  If not, or in any case, can anyone suggest a better method to solve the 
original problem?  (That is, how do I find the subset of all tags being those 
currently applied to a set of taggable EOs?)


-- 
Paul Hoadley
http://logicsquad.net/



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to