NHibernateFetching multiply collections in one roundtrip

time to read 1 min | 114 words

Please do not abuse, but this is really cool:

IList list = (IList)s.CreateMutliQuery()
 .Add("select b from Blog b left join fetch b.Users where b.Id = :id")
 .Add("select b from Blog b left join fetch b.Posts where b.Id = :id")
 .SetInt32("id", 123)
 .List()[0];
Blog b = list[0] as Blog;

More posts in "NHibernate" series:

  1. (19 Nov 2010) Complex relationships
  2. (27 Jun 2010) Streaming large result sets
  3. (25 May 2009) Why do we need to specify the query type twice?
  4. (20 Mar 2009) Avoid identity generator when possible
  5. (26 Mar 2007) Nullable DateTime Issues
  6. (08 Jan 2007) Fetching multiply collections in one roundtrip