I am trying to solve fairly standard problem of paging. I use select,
specifying limits, so it returns only necessary number of rows. But in
order to display correct page references I need to know how many
records available.

In MySql there is a syntax SELECT SQL_CALC_FOUND (
http://dev.mysql.com/doc/refman/5.0/en/information-functions.html
) ... which modifies behavior of following FOUND_ROWS() function. This
is exactly what I need. But I cannot find a way to accomplish it in
NHibernate (I am at 1.0.4 ;( ).

There is an excellent article about use of dialect for this purpose
( 
http://ayende.com/Blog/archive/2007/04/27/Paged-data--Count-with-NHibernate-The-really-easy-way.aspx
) but I cannot figure out how to add a keyword using custom dialect.

Some things I would rather avoid:

1) Creating a custom copy of NHibernate with proprietary extensions.
We burnt once with it.
2) Creating a custom ADO provider that modifies SQL on the fly. See
1).
3) Changing how application work. I'd rather let users dictate what
they want to see. If they want record/page count, so be it.
4) I know about MultiQueries in NH 1.2+. They are still noticeably
slower than this approach.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to