I'm trying to do the following with NHibernate 3.0's LINQ interface. I want to query for an object (using some Where clause), and load some children and grandchildren. Currently I'm doing it like so:
var results = session.Query<Thing>()
.Where(...)
.Fetch(x => x.SubThingA)
.ThenFetch(st => st.SubSubThingA)
.Fetch(x => x.SubThingB)
.ThenFetch(st => st.SubSubThingB)
// etc...
However, this results in a Cartesian product between all grandchildren (every result row contains many, many columns). This is discussed by "ayende" here. On the other hand I get a single round-trip, unlike splitting the query and then combining it.
How can I do it in a better (SQL and performance-wise) way, still using NHibernate's LINQ interface?
(For one thing, I've noticed that currently the ToFuture methods don't work when you use Fetch)
Thanks a lot!