Hi,
From what I can understand the pagination with SetFirstResult and SetMaxResults has a performance issue unless the database supports rownum natively (Oracle for example).
There are pagination strategies that could fix this performance issue and are very simple to implement.
The pagination algorithm I use in SQL server is:
SELECT ... FROM Table WHERE PK IN
(SELECT TOP @PageSize PK FROM Table WHERE PK NOT IN
(SELECT TOP @StartRow PK FROM Table ORDER BY SortColumn)
ORDER BY SortColumn)
ORDER BY SortColumn
See
http://www.codeproject.com/aspnet/PagingLarge.asp for more information.
I think a implementation like this would give a boost on NHibernate to be used on web applications and a lot of people would be very happy.
If you need any help developing this pagination algorithm count me on. I am a software developer.
Regards,
Rui