NHibernate Eager Fetching Over Multiple Levels

后端 未结 5 1870
野的像风
野的像风 2020-12-12 22:53

I have a 3-leveled hierarchy of entities: Customer-Order-Line, which I would like to retrieve in entirety for a given customer, using ISession.Get(id). I have the following

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-12 23:40

    You're getting 4XOrder and 4XLines because the join with lines doubles the results . You can set a Transformer on the ICriteria like :

    .SetResultTransformer(new DistinctRootEntityResultTransformer())
    

提交回复
热议问题