SetFetchMode call ignored

后端 未结 2 552
既然无缘
既然无缘 2020-12-21 09:35

I have a problem with SetFetchMode call in Criteria API in following query:

DetachedCriteria.For()
                .Add(u => u.Sta         


        
相关标签:
2条回答
  • 2020-12-21 10:01

    The solution is not so obvious. We have changed

    .CreateAlias("Companies", "comp")
    

    to

    .CreateAlias("Companies", "comp", JoinType.LeftOuterJoin)
    
    0 讨论(0)
  • 2020-12-21 10:18

    Since you are using .CreateAlias("Companies", "comp"), NHibernate can't eager-load the collection, as you could be using restrictions on that alias.

    My overall suggestion is to never use eager load on collections. Use batch_size or this trick instead.

    0 讨论(0)
提交回复
热议问题