[jboss-user] [EJB 3.0] - Re: onetomany relationship question
Wolfgang Knauf
do-not-reply at jboss.com
Tue Jul 7 09:13:00 EDT 2009
Hi,
actually, the "to many" side should be automatically populated when you access it. So, there is no need to perform entity manager queries.
Depending on the fetchType of the relationship, different things might happen:
If fetchType is "EAGER", then the children will be loaded when the parent is loaded. In this case, the EntityManager will fire some join statement against the database to load parent and childs with one query.
If fetchType is "LAZY", then the first call to "parent.getChilds()" will trigger the child collection loading. This will only work if the parent entity is under EntityManager control.
Hope this helps a bit.
Wolfgang
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4242194#4242194
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4242194
More information about the jboss-user
mailing list