We have 4 Tables,
One A to One B
One B to Many C
One C to Many D
All are configured Bi-directional and Lazy Fetch.
But if i try to fetch A, its fetching B also but not C and so. Is it a consistent behavior. How does it work?
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.
Yes, it is consistent behavior. Specification (JPA 2.0) is no too rigorous about expected result of using FetchType.LAZY:
Above is taken from the definition of OneToOne, but same holds for other relationships, LAZY is hint, not normative.
Additionally Hibernate had decided not to implement lazy fetching of OneToOne relationship. If you need it, take a look to this: Hibernate OneToOne lazy loading and cascading