[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1055) Query Pagination in JBoss Seam Framework

Antonio Navas (JIRA) jira-events at lists.jboss.org
Thu Mar 15 15:25:32 EDT 2007


Query Pagination in JBoss Seam Framework
----------------------------------------

                 Key: JBSEAM-1055
                 URL: http://jira.jboss.com/jira/browse/JBSEAM-1055
             Project: JBoss Seam
          Issue Type: Patch
          Components: Framework
    Affects Versions: 1.2.0.GA
            Reporter: Antonio Navas
            Priority: Minor


I'm not sure that this is the correct procedure, but I want to contribute to this project....

I think there is an issue regarding pagination in EntityQuery. The problem is that it adds an unnecessary last page when the actual size of the result list equals the maxResults attribute. For example, if maxResults is set to 5 and the total result count for the query is 10, the pagination returns 3 pages instead of 2, and the last page is empty. I think that the implementation of the methods "isNextExists" and "getLastFirstResult" are wrong, and the correct implementation should be:

	public boolean isNextExists() {
		return getResultCount() > (getFirstResult() == null ? 0 : getFirstResult()) + getMaxResults();
	}

	public long getLastFirstResult() {
		return ( (getResultCount()-1) / getMaxResults() ) * getMaxResults();
	}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list