I'm using NHibernate 2.1 with the LINQ provider and the results I get back from this query have multiple root nodes:
public IList<Country> GetAllCountries()
{
List<Country> results = (from country in _session.Linq<Country>()
from states in country.StateProvinces
orderby country.DisplayOrder, states.Description
select country)
.Distinct()
.ToList();
return results;
}
I know that using the Criteria API you can call DistinctRootEntityResultTransformer() to ensure that you get a unique root node, but I'm in the process of switching most of my queries over to the NHibernate LINQ provider, and I don't see an equavalient.
http://nhforge.org/wikis/howtonh/get-unique-results-from-joined-queries.aspx