Are there any other ways to avoid LazyInitializationExceptions in a Hibernate web application besides using the OpenSessionInView pattern? Are there any downsides to using OpenSessionInView?
Are there any other ways to avoid LazyInitializationExceptions in a Hibernate web application besides
Share
When working on our web applications, we usually decide beforehand which objects/fields will be needed in the view pages and make sure that all the objecs are properly initialized from the model before dispatching to the view.
This can be accomplished in (at least) three ways:
FetchMode.JOIN, if you’re using the Criteria API)Hibernate.initialize(property))About the downsides of OpenSessionInView, have you checked out this page?