Re: prefetch - a simple problem?

From: tnaki..ofthome.net
Date: Wed Mar 09 2005 - 10:22:01 EST

  • Next message: Sami Mohammed: "Primary key and sequence"

    Andrus Adamchik wrote:

    > Well, if you need a prefetch to optimize DB access, go back to
    > SelectQuery with prefetches instead of DataObjectUtils. Here is a
    > mechanism similar to DataObjectUtils internal working... but with
    > prefetches:
    >
    > Expression qualifier = ExpressionFactory.matchAllDbExp(idMap,
    > Expression.EQUAL_TO);
    > SelectQuery query = new SelectQuery(MyClass.class, qualifier);
    > query.addPrefetch("rel1");
    > query.addPrefetch("rel2.rel3");

    Thank you Andrus, it works like a charm, just as you no doubt expected
    it. I used matchExp and an addPrefetch.
    This reduced the number of queries two orders of magnitude. :)

    Tomislav



    This archive was generated by hypermail 2.0.0 : Wed Mar 09 2005 - 10:20:01 EST