I think this can be resolved by not disconnecting manually. Unless
you're in a transaction, the ISession will automatically release the
DbConnection back to the pool anyway.

/Oskar



2010/2/18 taoufik <taoufik.zam...@fortisinvestments.com>:
> We use one (read-only) session which we disconnect as soon as we
> retrieve the data from the database. The data retrieved, often has
> lazy-loaded properties which are not initialized yet.
>
> When we try to access the properties, the following exception gets
> thrown:
>
> NHibernate.LazyInitializationException
>
> Initializing[NHibernateTest.AppUser#16]-failed to lazily initialize a
> collection of role: NHibernateTest.AppUser.Permissions, session is
> disconnected
>
> Is there a way (add-on/interceptor) to automatically detect that the
> application is trying to access an uninitialized property, so that the
> interceptor can quickly open the connection and close it after the
> unit of work?
>
> Fetching everything at once would nullify the usage of laziness.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "nhusers" group.
> To post to this group, send email to nhus...@googlegroups.com.
> To unsubscribe from this group, send email to 
> nhusers+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to nhus...@googlegroups.com.
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to