views:

77

answers:

2

The NHibernate Book discusses very briefly queries that fetch several queries at the same time. They only show how to do this with the native CreateSQLQuery command. Are there any options for fetching multiple entities simultaneously using the criteria or hql APIs?

A: 

For executing several sql quires in one trip to the data base you can use futures. And also ado.net batch size can trigger NHibernate to join several db calls into one.

Sly
ado.net batch size is for updates ... correct me if I am wrong.
Rookian
and inserts in some cases
Sly
+2  A: 

You also have MultiCriteria / MultiQuery support for executing several queries in the same database-roundtrip, utilizing 1st level cache efficently.

http://gnschenker.blogspot.com/2007/06/optimize-nhibernate-queries.html http://ayende.com/Blog/archive/2007/05/20/NHibernate-Multi-Criteria.aspx

jishi