gorm-hibernate5
gorm-hibernate5 copied to clipboard
Total count from criteria builder is not including group property projection
Background
The total count from a criteria builder does not appear to include projections that group properties, resulting in a result set that is grouped but a total count that is just the count of all records.
Steps to reproduce
Create criteria builder to list results with projections that group properties, the result set appears to be correct but the total count query does not include any group by.
Expected behaviour
Total count query includes the same group by clauses defined in the result set query.
Actual behaviour
Total count query is not including any of the projections/group by and query appears to be a flat count.
select count(*) as y0_ from person this_
Environment Information
GORM Version: 7.1.0.M2 Grails Version (if using Grails): N/A JDK Version: Java 8 Database: Postgres or H2 file
Example Application
A Micronaut application with H2 database and simple test to confirm total count value from criteria.
https://github.com/nmkae/gorm-criteria-count