Quote:
I have a typical parent-child setup except that the parent has 3 child tables.
The relationship is one parent-many children for each table.
Parent - 0..n Child1
- 0..n Child2
- 0..n Child3
For optimization, I wish to retrieve a list of the parent records initially
without retrieving the children.
A second method will retrieve a specific parent record with the children.
I've looked in the various FAQs but haven't come across an answer
although many before must have tackled the issue.
I tried setting the child retrieval to "lazy".
However, even if the retrieve with details method explictly retrieves the
child records with a left "join fetch parent.child1", I get a "lazy"
initialization error since I then call the getChild1s() method after the
session is closed.
you're doing something wrong
check generated sql when calling .getChild1()
there are many ways to solve this problem.
next time, please give simplified mapping file, java code and filtered logs as said here
http://www.hibernate.org/ForumMailingli ... AskForHelp