Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 7af76df

Browse files
authored
Merge pull request #756 from darxriggs/getTotalCount-and-sorting
Fix getTotalCount() with Hibernate for sorting parameters
2 parents c1cb3d5 + 6b16e83 commit 7af76df

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/PagedResultList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public int getTotalCount() {
5858
if (totalCount == Integer.MIN_VALUE) {
5959
totalCount = hibernateTemplate.execute(new GrailsHibernateTemplate.HibernateCallback<Integer>() {
6060
public Integer doInHibernate(Session session) throws HibernateException, SQLException {
61-
final CriteriaQuery finalQuery = criteriaQuery.select(criteriaBuilder.count(queryRoot)).distinct(true);
61+
final CriteriaQuery finalQuery = criteriaQuery.select(criteriaBuilder.count(queryRoot)).distinct(true).orderBy();
6262
final Query query = session.createQuery(finalQuery);
6363
hibernateTemplate.applySettings(query);
6464
return ((Number)query.uniqueResult()).intValue();

0 commit comments

Comments
 (0)