[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-3179) Add method to Query for retrieving all records ignoring the maxResults

Alex Savitsky (JIRA) jira-events at lists.jboss.org
Fri Jul 18 11:21:52 EDT 2008


Add method to Query for retrieving all records ignoring the maxResults
----------------------------------------------------------------------

                 Key: JBSEAM-3179
                 URL: https://jira.jboss.org/jira/browse/JBSEAM-3179
             Project: Seam
          Issue Type: Feature Request
          Components: Framework
            Reporter: Alex Savitsky


Sometimes, I find myself using the same query in two distinct use cases - with the maxResults limit, and without one. Say, if I have a list of entities that is used as a dropdown lookup in another entity, then I need all records (let's say there are about 200 of them) when I'm making a dropdown, yet I might need only a subset of records when I'm making a management screen and want the entites paginated. Or I need to paginate entities for the screen display, but retrieve them all in a report that uses the same query.

Right now I ended up overriding framework.Query class, adding the following method to it:

	public List<E> getAllResults() {
		Integer currentMaxResults = maxResults;
		setMaxResults(null);
		List<E> result = getResultList();
		setMaxResults(currentMaxResults);
		return result;
	}

and using #{query.allResults} when I need them all. Maybe it makes sense to add it to this class on a permanent basis? It surely won't break anything, and might help covering an important usecase.

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

        



More information about the seam-issues mailing list