Standalone prefetch without main query?

John Pollard <[email protected]>
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
An eof prefetch brain teaser,

I have an object StockGroup that has a relationship stockItems(). I have a 
number of StockGroup objects already in my editing context. I know I am 
going to access all of the stockItems() arrays so I don't want a query 
triggered for each one.

The solution I have come up with is to write a fetch spec to fetch 
StockGroups based on their primary keys and to prefetch the stockItems 
relationship.

That is not bad because it results in just two queries (the StockGroup 
query and the StockItem prefetch query). However, in an ideal world I only 
need the second (prefetch) query to execute because I already have the 
StockGroups in memory.

I am only running the query against the StockGroup entity because it is the 
only way I know to populate the stockItems() of a number of StockGroups in 
one go. Is there another way? Some way I can just run the prefetch bit of 
the query which is the bit I need?

Thanks
John
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.