Reputation: 452
I want to store my object in ASP.NET Session. This object has some lazy loaded properties. When I do postback to my page and get my object from Session, this properties throw LazyInitializationException. Can I rebind this object to newly creates Nhibernate Session to retrieve this properties or I have to create Session and get this object on each request?
Upvotes: 1
Views: 199
Reputation: 1038720
You need to eagerly fetch those objects at the moment you send the SQL query so that they are populated and accessible from the session on the next request. Once the session that was used to retrieve the parent object is closed you cannot fetch them anymore.
Upvotes: 1