Hi Mauro, have to admit I didn't get the question cause of all the typo on this one.
That said you have 2 ways to deal with lazy fields (relationships or not) in JPA 2.0 or JPA 2.1 - this last one doesn't really change things even with entity graph: a- either you want them to be loaded eagerly: then 1,2,3 are fine and depends if your need if dynamic (criteria) or fixed (jpql). Entity graph will add few more flexibility on the mapping but not much. b- you want them to really be lazy and therefore just load the root entity and query them later Note that if you use cache for the relationships you can desire to use option b and still behave as a cause the entities will be in the cache (so the N+1 queries can be faster than the eager fetching). Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber <http://www.tomitribe.com> | JavaEE Factory <https://javaeefactory-rmannibucau.rhcloud.com> 2016-08-14 11:50 GMT+02:00 mauro2java2011 <[email protected]>: > Hi all. > I have a bit confusion on what use for query lazy relations with jpa 2.0 / > 2.1.. > I kniw that many way us possible: > > 1) jpql query with join fetch > 2) use tge Criterua query. > 3) use tge Fetch group. > > For jpa 2.1( into tomee 7.0.1 plume only because it came with joa 2.1 > Ecluose-link implemenration ) are possibossible the 3 whays above plus the > new feature of jpa 2.1 : > > Entity graph. > > Please explain me when select to use the option 1 -or 2 or -3 respect the > others with jpa2.0 ( openjpa with tomee plus ) abd conveniences of a whay > respeft the others. > > Also with jpa 2.1 the convenience of use entity graphs respect tge other > 1-2-3 options. > > Tank you very much. > Mauro > > > > -- > View this message in context: http://tomee-openejb.979440. > n4.nabble.com/jpa-what-use-for-resolve-the-Lazy-loading- > problem-tp4679732.html > Sent from the TomEE Users mailing list archive at Nabble.com. >
