users@glassfish.java.net

Re: FetchType.EAGER behaviour

From: <glassfish_at_javadesktop.org>
Date: Wed, 11 Jul 2007 07:55:19 PDT

In the case of FetchType.EAGER TopLink is optimised for cache usage. If the related objects are in the cache (which is usually the case if the data is actually being used by the end user) then an in memory query is much faster than processing a FETCH JOIN especially if the join in on a collection as a FETCH JOIN can be quite burdensome on a database and include massive amounts of data especially on multilevel collection joins. If the data is not in the cache then more queries must be performed which can be taxing on a system but in a general application not joining is usually better. Be aware that if the multi-level relationships are joined at the mapping level [i]every[/i] query for the root class will require the multi-level join to be processed.
If there is a particular use case in your application where the multi-level join is required then a JPQL query can be performed that will JOIN the required attributes.
What is your use case for mapping this attributes as always JOINED.
--Gordon
[Message sent by forum member 'gyorke' (gyorke)]

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