"Failed to lazily initialize a collection"
try
{
session = Class1.GetFactory().OpenSession();
Archives archives= session.Get(typeof(Archives), id) as Archives;
NHibernate.NHibernateUtil.Initialize(archives.ArticlesList);return archives;
}
catch (Exception ex)
{
throw ex;
}
finally
{
session.Close();
}
或者
session.CreateCriteria(typeof(Catalog))
.Add(Expression.Eq("ID"),id)
.SetFetchMode("Specifications",FetchMode.Join)
.UniqueResult() as Catalog;
或者
left JOIN FETCH
这样在session关闭 照样取他的 级联对象 ,