Using OpenSessionInViewInterceptor with Hibernate and JSF 2
Posted
by sammy
on Stack Overflow
See other posts from Stack Overflow
or by sammy
Published on 2010-06-13T21:22:12Z
Indexed on
2010/06/13
22:32 UTC
Read the original article
Hit count: 489
I'm building an application in Hibernate, Spring and JSF2 using only annotations. How can I take advantage of OpenSessionInViewInterceptor found in Spring to catch any hibernate session that might open within a bean?
I'm trying to elegantly solve the common “failed to lazily initialize a collection of role: your.Class.assocation no session or session was closed.” problem when trying to read from a yet uninitialized list of POJOs inside another POJO (A Tag entity retrieved by a DAO that contains a List of Project objects I want to read). I've found this:
http://www.paulcodding.com/blog/2008/01/21/using-the-opensessioninviewinterceptor-for-spring-hibernate3/
but failed to make use of it in my environment.
Please provide a detailed answer, as the Internet is full of foggy, unhelpful tutorials. I'll also be greatful for an alternative solution, given a step-by-step instruction is provided.
© Stack Overflow or respective owner