Hello,

I have two IPreUpdate event listeners that both need to save
additional entities at the time another entity is updated.

To perform this in each listener, I open a child session, save the
entity, and flush the child session. However, if I dispose of the
child session in the event listeners, I get a "Session is Closed!"
error when the second listener runs.

Looking at the code in NH trunk, the child sessions are being re-used
based on EntityMode which explains why this is happening. Are there
any reasons why NH couldn't actually create a new child session each
time?

Secondly, I want to ask a question about the summary comment for
ISession.GetSession(EntityMode entityMode) that shows up in
intellisense:
===
Starts a new Session with the given entity mode in effect. This
secondary
Session inherits the connection, transaction, and other context
information from the primary Session. It doesn't need to be flushed
or closed by the developer.
===

Why does it says the child session "doesn't need to be flushed"? In at
least my specific example, if I don't flush the child session, the
entities I save never get persisted.

Thanks!

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

Reply via email to