persistence@glassfish.java.net

Re: Nested Fetch Joins

From: Markus KARG <markus.karg_at_gmx.net>
Date: Mon, 07 Apr 2008 18:07:50 +0200

Hi Adam,
> in my current project, we would like to minimize the amount of round
> trips to the database (slow network with high latency) and fetch the
> whole object graph into the cache once. It starts with one root-object
> instance.
> Especially all lazy-relations should be loaded with as few as possible
> SQL-statements.
>
> Some questions:
> - does TopLink support "nested" fetch joins?
> - is it possible to prefetch selected relations in another way (e.g.
> proprietary TopLink extensions)?
I do not have a solution for you as I am not involved in that part of
TopLink, but I think that nobody by intention wants TopLink to run more
SQL statements then needed, independent of the bandwith. Saying that, if
TopLink does more SQL statements than needed, I would rate it as a bug,
not as an optimization. ;-)

So relying on the thesis that TopLink already does the minimal number of
SQL statements, a possible optimization could be to put together several
SQL statements in a single roundtrip, using batch mode. I am not sure
whether TopLink already supports that. Can anybody of the TopLink team
give us a definitive statement whether this is possible? I am also very
interested in this question, since I am in a similar situation as Adam's
customer. :-)

Thanks
Markus

-- 
http://www.xing.com/go/invita/58469