PDA

View Full Version : Exception=org.hibernate.LazyInitializationExceptio n



JohnDew
Mar 11th, 2008, 01:17 AM
Hi all,
I am getting the below error.
ERROR [com.a.b.web.ListDoctorController] - Error getting Doctor List. Exception=org.hibernate.LazyInitializationExceptio n: failed to lazily initialize a collection of role: com.a.b.domain.Hospital.doctors - no session or session was closed

Please help me in knowing the cause of this error and to debug. I did a google search but not satisfied.
Thanks in advance.

dr_pompeii
Mar 11th, 2008, 08:36 AM
post you code
to see what are you doing

regards

Steve O
Mar 11th, 2008, 12:29 PM
John,

The easiest way to fix this is to use a OpenSessionInViewFilter or OpenSessionInViewInterceptor. Also, search the forum there are a ton of posts on this exact error.

Good luck,

Steve O