Support pagination: total rows ignore limit
-------------------------------------------
Key: HHH-4618
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4618
Project: Hibernate Core
Issue Type: New Feature
Components: core
Environment: JBoss 5.1.0GA
Reporter: Dave
Limit is used for pagination, but total number of rows must be known to calculate page
count.
Currently we have to use two queries:
1. select * from Student where age<30 limit 20;
2. select count(*) from Student where age<30;
For complex query with joins/huge tables, it can be a performance issue.
For Criteria API query with group by, there is no way to get row count, for example
criteria.setProjection(Projection.projectionList().add(Projections.groupProperty("name")).add(Projections.sum(score)));
Currently there is no way to get row count of this query using Criteria API.
For MYSQL, SQL_CALC_FOUND_ROWS and FOUND_ROWS() are used to get row count ignoring limit.
Pagination is used for all web application. Hibernate should support it in HQL and
Criteria API.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira