Re: Prefetching: Fetching versus Firing Faults?

Lenny Marks <[email protected]> Tue, 14 Sep 2004 07:23:18 -0400
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
I have this posted at wocode. It allows you to to do  batch faulting  
using keypaths relative to existing EO's. Sounds like what your looking  
for.

http://wocode.com/cgi-bin/WebObjects/WOCode.woa/1/wa/ 
ShareCodeItem?itemId=337&wosid=wRwZtXebdcJORzNjIywlRM

NSArray customers = ..; //already fetched
NSMutableArray keypaths = new NSMutableArray();
keypaths.addObject("address");
keypaths.addObject("purchases");
EOFUtils.batchFetch(customers, keypaths);

-lenny

On Tuesday, Sep 14, 2004, at 00:55 America/New_York, Ashley Aitken  
wrote:

>
> Howdy All,
>
> When one uses a fetch specification (either programmatically or from  
> an EOModel) you can specify objects to prefetch (along with the  
> fetched objects).  For example, if I was fetching a customer object I  
> could specify to prefetch the customer.address object and the  
> customer.purchases array of objects.
>
> Is it possible to have the same (or similar functionality) when a  
> fault is fired?  For example, if I had a salesperson object that had a  
> fault for the relationship customer, when the salesperson object  
> accessed the customer object it would fetch not only the customer but  
> also prefetch (as above).
>
> Would I need to set up my own fault handler (subclass of  
> EOFaultHandler) or is there a simpler way?  I would like to be able to  
> just traverse the object graph and have this prefetching happen,  
> rather than having to do explicit (programmatic or named) fetches all  
> the time.
>
> Thanks for any suggestions or pointers.
>
> Cheers,
> Ashley.
>
> --
> Ashley Aitken
> Perth, Western Australia
> mrhatken at mac dot com
>
> _______________________________________________
> EOF mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/eof
>