Message:
The following issue has been closed.
---------------------------------------------------------------------
View the issue:
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-143
Here is an overview of the issue:
---------------------------------------------------------------------
Key: HB-143
Summary: Criteria.count() and Query.count()
Type: New Feature
Status: Closed
Priority: Minor
Resolution: DUPLICATE
Project: Hibernate2
Components:
core
Assignee:
Reporter: Alexey Kaigorodov
Created: Wed, 18 Jun 2003 10:53 PM
Updated: Thu, 8 Jan 2004 2:34 PM
Description:
Add method count in classes Criteria and Query.
Example:
final int PAGE_SIZE;
int position;
...
Query query = ... // build complex query with many parameters
int pageNum = position / PAGE_SIZE + 1;
int pageCount = query.count() / PAGE_SIZE + 1; // <-- HERE
System.out.println("Page " + pageNum + " from " + pageCount);
query.setFirstResult(position);
query.setMaxResults(PAGE_SIZE);
List page = query.list();
System.out.println(page);
Not necessary will twice create the similar Query or Criteria.
By Criteria always easy build sql count query.
For Query.count() throw exception if create sql count query impossible.
---------------------------------------------------------------------
JIRA INFORMATION:
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.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|