Skip to content

Commit

Permalink
Merge pull request #756 from darxriggs/getTotalCount-and-sorting
Browse files Browse the repository at this point in the history
Fix getTotalCount() with Hibernate for sorting parameters
  • Loading branch information
puneetbehl authored Oct 5, 2023
2 parents c1cb3d5 + 6b16e83 commit 7af76df
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public int getTotalCount() {
if (totalCount == Integer.MIN_VALUE) {
totalCount = hibernateTemplate.execute(new GrailsHibernateTemplate.HibernateCallback<Integer>() {
public Integer doInHibernate(Session session) throws HibernateException, SQLException {
final CriteriaQuery finalQuery = criteriaQuery.select(criteriaBuilder.count(queryRoot)).distinct(true);
final CriteriaQuery finalQuery = criteriaQuery.select(criteriaBuilder.count(queryRoot)).distinct(true).orderBy();
final Query query = session.createQuery(finalQuery);
hibernateTemplate.applySettings(query);
return ((Number)query.uniqueResult()).intValue();
Expand Down

0 comments on commit 7af76df

Please sign in to comment.