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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s