For query pagination users sometimes want a convenient way to just get the number of pages by running a count query. Of course it’s not difficult to implement this on top of our APIs, but since every framework built on top of Hibernate reimplements this, we may as well provide a standard implementation. To be clear, we would implement this by:
- messing with the SQM tree for HQL and criteria queries, and
- by wrapping in an outer select for native queries (or, perhaps, in the case where there’s only one select keyword in the query, by just replacing the select list).
|