cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lachlan Deck <lachlan.d...@gmail.com>
Subject Re: Default Prefetching
Date Wed, 19 May 2010 12:48:55 GMT
On 19/05/2010, at 5:30 PM, Gary Jarrel wrote:

> Do you think it is something that could be implemented via Annotations?
> 
> Perhaps a class level or method annotation
> 
> @Prefetch("products.orders");
> public class Category() {
> 
>    @Prefetch // this could pre-fetch products
>    @Prefetch("orders") // this could pre-fetch products.orders
>    public List<Product> getProducts() {
>        ....
>    }
> }

You could utilise those annotations yourself, in the absence of an officially supported mechanism,
by subclassing SelectQuery and creating your own library of annotations (with runtime retention)
and it'd be quite simple.

I suspect a more official approach would involve adding prefetch definitions to the model.

with regards,
--

Lachlan Deck


Mime
View raw message