This content has been marked as final.
Show 4 replies
-
1. Re: How to specify a query for lazy initialized collection
pmurphy.pjmurphy.paddypower.com Jul 16, 2009 2:27 PM (in response to pmurphy.pjmurphy.paddypower.com)EL Expression should read (forgot to format)
#{foo.bars}
-
2. Re: How to specify a query for lazy initialized collection
pmurphy.pjmurphy.paddypower.com Jul 16, 2009 4:00 PM (in response to pmurphy.pjmurphy.paddypower.com)Actually, forget about this question as the elements in the foo are contained in a Set (i.e. unordered this would never work.
-
3. Re: How to specify a query for lazy initialized collection
jeanluc Jul 16, 2009 7:10 PM (in response to pmurphy.pjmurphy.paddypower.com)To avoid an extra roundtrip to the db you can also have a separate query with join fetch that is used for that particular case.
-
4. Re: How to specify a query for lazy initialized collection
cash1981 Jul 19, 2009 11:39 PM (in response to pmurphy.pjmurphy.paddypower.com)Yes. What you will need to do is us use fetch. Fetch will eagerly fetch the join. So in your foo.bars you will in your entityManager.createQuery(
select foo from Foo foo where join fetch foo.bar
)