Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

org.hibernate.LazyInitializationException

 
Todd Smith
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting a Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: gov.michigan.mdch.ibs.domain.Users.userRoleses, no session or session was closed.


I am using JQUERY for my Ajax to call the controller. The Controler will pass back a JSON object to be render in a div tag on the JSP
I know the user bean I am trying to return has 2 children tables. I have included the user bean and the DAO. I have tried the OpenSessionInViewFilter in the web.xml and that is not working. I just wanted to know if you had any ideas.
Thanks
Todd


 
Gerardo Morales
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could try to use interceptors instead of filters. Anyway, the OpenSessionInViewFilter should work fine.

Did you do a filter mapping after defining the filter on the web.xml?

You can find an example of a web.xml file and you can also download a little sample project that uses OpenSessionInViewFilter here:
http://blog.gmorales.net/2012/03/how-to-solve-orghibernatelazyinitializa.html

Good luck!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic