LazyInitializationException: could not initialize proxy-the owning Session was closed


Solution 1

You have a classic case of LIE – Lazy Initialization error. This topic has been discussed so many times that I suggest to do a search on the forum and point to the hibernate documentation. Basically, you are using lazy relationships that require an open session (so the lazy loading can happen). Inside Spring you can use OpenSessionInViewFilter/Interceptor or the HibernateInterceptor to keep a Hibernate session open during a request or method calls.

Solution 2

@Entity

@Table(name=”gis_point”)

@org.hibernate.annotations.Proxy(lazy=false)

Entity {

}

http://forum.springsource.org/showthread.php?t=27993

http://www.myeclipseide.com/PNphpBB2-viewtopic-t-12830.html

http://stackoverflow.com/questions/345705/hibernate-lazyinitializationexception-could-not-initialize-proxy