Re: prefetch & many-to-many

From: Mike Kienenberger (mkienen..laska.net)
Date: Fri Nov 07 2003 - 08:30:22 EST

  • Next message: Tore Halset: "Re: prefetch & many-to-many"

    Tore Halset <halse..vv.ntnu.no> wrote:
    > I want to query for all groups and prefetch elements, but the prefetch
    > does not happen
    >
    > SelectQuery query = new SelectQuery(Group.class);
    > query.addPrefetch("elements");
    > List groups = dataContext.performQuery(query);
    >
    > Result in one query on group and lots of queries on element. Am I doing
    > anything wrong?

    Isn't that what should happen?

    If there was no prefetch, there'd be a single query on Group.

    With the prefetch, you'd get an additional query for every Group fetched.

    select * from Element where elementID = Group.elementID



    This archive was generated by hypermail 2.0.0 : Fri Nov 07 2003 - 08:30:20 EST