Re: Default Prefetching

From: Marcin Skladaniec (marci..sh.com.au)
Date: Wed May 19 2010 - 05:14:34 UTC

  • Next message: Marcin Skladaniec: "Re: Default Prefetching"

    Hi Gary

    Prefetching a select query which should meet your requirements:
    SelectQuery sq = new SelectQuery(Category.class);
    sq.addPrefetch(Category.PRODUCTS_PROPERTY);
    sq.addPrefetch(Category.PRODUCTS_PROPERTY+"."+Product.ORDERS_PROPERTY);
    context.performQuery(sq);

    http://cayenne.apache.org/doc30/prefetching.html

    All best
    Marcin

    On 19/05/10 2:11 PM, Gary Jarrel wrote:
    > Hi All
    >
    > Is there a way to define default prefetching on a Persistent object?
    >
    > Eg:
    >
    > If I have:
    >
    > Category -> Products -> Orders
    >
    > I want to call category.getProducts() and automatically prefetch all the
    > Orders for the products which are returned?
    >
    > Thank you
    >
    > Gary
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed May 19 2010 - 05:15:15 UTC