You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by do...@xsinet.co.za on 2012/09/06 12:54:13 UTC

Prefetching Question

If for example i have the following classes: Person, Hobbies and Hobby

Hobbies has fields:  personId and hobbyId

If no prefetching is done on the original Person query, is there a way to 
prefetch Hobby when calling getHobbies() on Person ?

Thanks.


Re: Prefetching Question

Posted by Aristedes Maniatis <ar...@maniatis.org>.
On 6/09/12 8:54pm, dollj@xsinet.co.za wrote:
> If for example i have the following classes: Person, Hobbies and Hobby
>
> Hobbies has fields:  personId and hobbyId
>
> If no prefetching is done on the original Person query, is there a way to
> prefetch Hobby when calling getHobbies() on Person ?

Just flatten the join and simplify your code:

   http://cayenne.apache.org/doc/flattened-relationships.html


Ari



-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A