If I use the approach of the CTE, like explained in this article:
http://nhibernate.hibernatingrhinos.com/16/how-to-map-a-tree-in-nhibernate
I am able to retrieve the correct data, so for instance, when I run a
query that returns two Root and two children for one root
I get this:

- Item01 (the parent)
- Item02 (child of Item01)
- Item03 (child of Item01)
- Item04 (the parent)

And I use this call to full prepare the result:


                var result = this.unitOfWork.GetSession<ISession>()
                    .CreateSQLQuery(sql)
                    .AddEntity("item", typeof(Item))
                    .AddJoin("parent", "item.Parent")
                    .AddJoin("children", "item.Child")
                    .SetResultTransformer(Transformers.DistinctRootEntity)
                    .List<Workbook>();

But it returns a List<Item> with the following structure

- Item01
  - Item02
  - Item03
- Item02 (redundant)
- Item03 (redundant)
- Item04

How I can get rid of the redundant items if the DistinctRootEntity
transformer does not work??
Thank you

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