Told you, we love sharing!
I have been using the following code to get paginated result and the total number of results returned irrespective of the pagination params. def result=SampleDomain.createCriteria().list(){ // multiple restrictions maxResults(params.max) firstResult(params.offset) } // Return type is ArrayList Integer totalResult=SampleDomain.createCriteria().count(){ // multiple restrictions // maxResults(params.max) // firstResult(params.offset) } Clearly duplicating the same closure except for the pagination […]