users@glassfish.java.net

How to enable Eager Loading for OneToOne and ManyToOne entity relationships

From: <glassfish_at_javadesktop.org>
Date: Mon, 12 May 2008 12:09:55 PDT

I have two entities A and B which have a "OneToOne" relationship. You can navigate from entity A to entity B. The relationship is annotated with FetchType.LAZY.

Now, in business tier, I am getting an instance of entity A via the find() method of the EntityManager. I pass this instance of entity A to the web tier. Although the relationship is annotated with FetchType.LAZY I can access all fields of entity B in the web tier. So entity B is not fetched lazily but eagerly. :\

----------

Is this the expected default behavior in Glassfish with TopLink Essentials?

How do I enable Eager Loading for OneToOne and ManyToOne entity relationships (using Glassfish with TopLink Essentials)?

(btw, I have already tried "<property name="toplink.weaving" value="true"/>" in persistence.xml, with no effect.)

I am using Sun Java System Application Server 9.1_02 (build b04-fcs)
[Message sent by forum member 'zebhed' (zebhed)]

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