I have an issue that when I `ISession.Lock(..., LockMode.None)` an
entity into a new session, entities of an initialized ISet's aren't
locked.

If I'm correct, the following happens. When I lock an entity that was
already initialized in a different session, not only the entity that I
lock, but the entire entity graph is locked into the new session. In
other words: it looks like NHibernate walks down foreign key
relationships and also locks these entities into the new session.
However, entities inside initialized ISet's aren't locked. When I
trigger a proxy load of a foreign key of an entity inside an ISet (of
an entity which was initialized in a previous session), I get an
exception that the session has gone away.

I have two questions. Firstly, is my interpretation correct?

Secondly, how should I work with this. Currently, I have implemented a
test scenario that walks the graph and recursively locks entities
inside an initialized ISet (`set is IPersistentCollection &&
NHibernateUtil.IsInitialized(set)`). Is this the correct way, or are
there NHibernate provided alternatives? This seems to work but also
looks like something I shouldn't be doing manually.

-- 
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