For reporting scenarios, specially for large records (+millions records) I decided to bypass the nhibernate object mapping! and directly map to DataSet!
Here is the algorithm
ICriteria criteria = _session.CreateCriteria(entityType);
// Add some filters and paging to criteria
ISQLQuery sql = GetGeneratedSql(criteria); // According to (http://stackoverflow.com/questions/10704462/how-can-i-have-nhibernate-only-generate-the-sql-without-executing-it/10710451#10710451)
IList<object[]> data = sql.List<object[]>();
I didn't figure out how to find the columns that nhibernate used to build the SQL
If you need a DataSet
can use this transformer:
here
Its transform to a DataTable
but is easy to handle it.