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

Jonas Erma (JIRA) jira-events at lists.jboss.org
Mon Mar 26 06:06:55 EDT 2007

    [ http://jira.jboss.com/jira/browse/JBSEAM-1055?page=comments#action_12357268 ] 
Jonas Erma commented on JBSEAM-1055:

Forum post:


> 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