consider this scenario:
- I have loaded a Parent entity through hibernate
- Parent contains a collection of Children which is large and lazy loaded
- The hibernate session is closed after this initial load while the user views the Parent data
- The user may choose to view the contents of the lazy Children collection
- I now wish to load that collection
What are the ways / best way of loading this collection?
- Assume session-in-view is not an option as the fetching of the Children collection would only happen after the user has viewed the Parent and decided to view the Children.
- This is a service which will be accessed remotely by web and desktop based client.
Thanks.
I’m making some assumptions about what the user is looking at, but it seems like you only want to retrieve the children if the user has already viewed the parent and really wants to see the children.
Why not try opening a new session and fetching the children by their parent? Something along the lines of …