After fixing the problem in my project, I tried some tests. I found if there are any references(many-to-one) on the path to a lazily loaded set, the loading will fail in a ressociated session:
Code:
[Test]
public void LazyLoadingInReassociatedEntity()
{
ClassA a = null;
using (ISession session1 = nhManager.Factory.OpenSession())
{
a = (ClassA)session1.Load(typeof(ClassA), 123);
}
using (ISession session2 = nhManager.Factory.OpenSession())
{
session2.Lock(a, LockMode.None);
Assert.IsTrue( (a.B.CSet.Length > 0, "CSet should not be empty.");
}
}
[/code]