PDA

View Full Version : NHibernate.LazyInitializationException: Could not initialize proxy - the owning Sessi


Ismar Slomic
05-14-2007, 10:16 AM
I'm using NHibernate with Spring in the web application. I get this exception when i try to persist a object (after the page is loaded for first time):

Could not initialize proxy - the owning Session was closed.

Exception Details: NHibernate.LazyInitializationException: Could not initialize proxy - the owning Session was closed.

After doing some researches on this forum and reading the article http://www.hibernate.org/43.html
I realize that this is a common issue on web-apps. As I understood i need to open session in view. Im using a three-tier approach and my configuration is very similar to Northwind example.

I would appriciate if someone could explain in details how I can fix this.

Tnx in advance,
Ismar

Erich Eichinger
05-21-2007, 12:13 AM
I guess, this is the same issue you describe here (http://forum.springframework.net/showthread.php?t=2708)?

-Erich

Ismar Slomic
05-21-2007, 07:40 AM
Hi Erich,
Yes it is. Sorry for make 2 thread for same topic, you can just remove it if you like to :)