It’s possible to override LAZY in HQL using LEFT JOIN FETCH.
FROM Obj AS obj LEFT JOIN FETCH obj.otherObj WHERE obj.id = :id
Is it also possible to override EAGER? How?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The qualifier in this snippet from the Hibernate Docs implies that you can override lazy with eager, but not the other way around:
Unusually, it looks like you can if you use the Criteria API to go from eager to lazy. Just call
setFetchMode(FetchMode.LAZY)on the relevant join.