I have parent-child relation in a table that describe a tree
structure. How can I prelaod the whole tree with only a certain "type"
of elements?

For example if I have a Person table with a relation chef<--employee
and each person can be in one or more departments, how can I preload
the whole tree of the people for one department?

In sql I would just query the table Person and get all the people in
the department and build the tree in code:

SELECT p.* FROM Person p JOIN PersonDepartment pd ON p.Id=pd.PersonId
AND pd.DepartmentId=1

How can I have the same result in nhibernate without having nhibernate
select each time all the children of a person? That is, only one query
to the database and only the needed children?

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