Pagination behavior change when upgrading Hibernate from 5.6 to 6.0 with fetch joins and ORDER BY
Goal: obtain predictable pagination results for a JPQL/HQL query that uses fetch joins on a OneToMany association and includes an ORDER BY clause when upgrading from Hibernate 5.6 to 6.0 with the MySQL dialect. In Hibernate 5.6 the limit/offset is applied before distinct root‑entity filtering, which can cause duplicate root rows in the result set. Hibernate