createCountQuery with Hibernate 6.6.2
Description
Attachments
1
Activity
Show:
Patrick Schlosser November 20, 2024 at 8:12 AM
How can I test this? If I use this in the test-case and set version to 7.0.0.Beta2 I got the error:
Could not find artifact org.hibernate.orm:hibernate-scan-jandex:jar:7.0.0.Beta2
Gavin King November 15, 2024 at 3:14 PM
should be fixed by , please test and confirm.
Patrick Schlosser November 15, 2024 at 2:43 PM
The source query maybe has the order by property in its selection like the reproducing example shows.
Select:
And the resulting countQuery looks like this:
Christian Beikov November 15, 2024 at 1:06 PM
Wouldn’t the source query also fail for the same reason? Getting rid of the order by clause when there is not fetch/offset clause definitely is desirable, but still, your code seems wrong.
Fixed
Details
Details
Assignee
Gavin King
Gavin KingReporter
Patrick Schlosser
Patrick SchlosserLabels
Worked in
Fix versions
Affects versions
Priority
Created November 15, 2024 at 9:15 AM
Updated December 17, 2024 at 2:06 PM
Resolved November 27, 2024 at 2:41 PM
When creating a countQuery the countQuery contains the orderby criteria from the source query, and if this is also a distinct query, the countQuery fails:
This ends in sql like this:
ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list