Lazy loading lazy=extra no session or session was cosed

22 views
Skip to first unread message

hoghweed

unread,
Dec 17, 2012, 4:53:44 AM12/17/12
to nhu...@googlegroups.com
Hi,
I have a strange behavior which I can find any solution for days..
The behavior I experience is the classic LazyInitializationException with "no session or session was closed" 
which is usual when there's no contextual session and trying to access lazy loaded properties/collections, when I trying to 
access lazy collections with "extra" lazy mode

The context is:
  • Session-per-request session bounded with Spring.NET OpenSessionInViewModule
  • Entities with collection as "list" (mapping list collection) with lazy="extra" or with "set" (mapping set collection)
  • The issue is caused mainly with lazy=extra
  • It seems that the Count statement for extra cound be done, but accessing the whole collection throws the exception
After investingating the usual issues, no session opened, a call made to Session.Clear or Evict, I found no explicit reasons of why this happen..
A strange behavior is if I profile in NHprof, I see the exception in a new session, in other words, the contextual session works correctly,
but when the exception is thrown, that exception is visualized in a secondary sessoin.. but NO code open a session, and a single, contextual session 
is opened..

Anyone knows what other reasons could cause a situation like that?
Thanks in advance

Pete Appleton

unread,
Dec 17, 2012, 5:46:51 AM12/17/12
to nhu...@googlegroups.com

Could you paste some (minimal) code illustrating the problem please?

 

/Pete

--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/Lpa9EMgyt8EJ.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
!DSPAM:1,50ceebb874171169385064!

Reply all
Reply to author
Forward
0 new messages