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