RenderingContext::aliasCount is not preserved between createQuery() calls, leading to incorrect query if CriteriaQuery is changed
Description
Attachments
1
Activity
Show:

Christian Beikov December 22, 2023 at 7:22 PM
This is not a problem in Hibernate ORM 6 anymore.
As far as I know it's not prohibited to change CriteriaQuery between createQuery() calls. Internally Hibernate assigns aliases to used roots on first createQuery() call. Those aliases can conflict with aliases from new subquery conditions added after before second createQuery() call, leading to incorrect query generated.