users@glassfish.java.net

FetchType.EAGER behaviour

From: <glassfish_at_javadesktop.org>
Date: Wed, 11 Jul 2007 05:15:40 PDT

Hi,

We have a fairly complicated tree structure where we would like toplink essentials to fetch the whole tree as fast as possible. The structure is something like this:
Level1 has a Collection<Level2>
Level2 has a Collection<Level3>
Level3 has a Collection<Level4>
etc.

The levels above are entities and the FetchType for the children is EAGER.

When we look at the actual sql toplink generates db(Oracle), we see that the eager doesn't seem to affect the queries as expected. It makes two identical selects and not a join. Hence, the children aren't fetched and are (later) retrieved lazily with 1 select per child (slooow).

We use static weaving, which works fine. (and doesn't make any difference when disabling it)

What are we doing wrong?
[Message sent by forum member 'danielcroth' (danielcroth)]

http://forums.java.net/jive/thread.jspa?messageID=226153