We're updating the issue view to help you get more done. 

Criteria query/HQL ast without ORDER BY + EntityGraph = ignored GROUP BY

Description

Adding an EntityGraph (containing an attribute annotated with @OrderBy) hint to a Criteria Query or HQL that defines a groupBy but no orderBy causes the ORDER clause to be inserted before the GROUP clause in the tree, therefore causing the SqlGenerator to (rightfully) ignore the GROUP clause when converting the tree to SQL.

Test case included to the best of my ability in the PR.

Environment

Hibernate 5.2.17, jdk 1.8.0_171, MySQL 8.0.12 for Win64 on x86_64

Status

Assignee

Unassigned

Reporter

Michael Zoller

Fix versions

None

Labels

backPortable

Backport?

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

Components

Affects versions

5.2.17
5.3.6

Priority

Major