See reproducer application here: https://github.com/imperatorx/hibernate-reproducer-1/blob/master/src/main/java/com/example/reproducer/ReproducerApplication.java Problem: When selecting a parent entity grouped by a static field (string) and two lazy related entities, it depens on the order of selection if Hibernate generates a corrent SQL query or not. Regression:
- With Hibernate 6.1 (spring boot 3), if the first field in the select is a referenced entity, the query fails with PostgreSQL with column "l1_0.id" must appear in the GROUP BY clause or be used in an aggregate function
- With Hibernate 6.1 (spring boot 3), if the first field in the select is a static field, the query succeeds
- With Hibernate 5 (spring boot 2), both ways work.
|