I have a pretty complex domain entities. I want to have lazy loading for all of associations. So the scenario is like this:
1.get an instance of my business logic.
2.get an object o from business.
3.ask o to give me other associated objects.
4.prepare the view.
To get rid of hibernate exceptions about closed session when lazy load other objects, I’ve come up to the idea to open and close entire session in controller. Is it a good idea? Are there any better solutions?
Thank you
Session in view is a bad practice.
Here is a suggestion for layers which are typically used to work around this problem:
Controller
Service
Data Access