Kai Zander (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMWMzYmRlMzEx...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-15477?atlOrigin=eyJpIjoiMWMzYm...
) HHH-15477 (
https://hibernate.atlassian.net/browse/HHH-15477?atlOrigin=eyJpIjoiMWMzYm...
) [Hibernate 6] Criteria EXISTS Subquery Causes "Error interpreting query [SqmRoot
not yet resolved to TableGroup]" (
https://hibernate.atlassian.net/browse/HHH-15477?atlOrigin=eyJpIjoiMWMzYm...
)
Issue Type: Bug Affects Versions: 6.1.2 Assignee: Unassigned Attachments: example.zip
Components: query-criteria Created: 02/Sep/2022 14:04 PM Environment: Hibernate 6.1.2
Java 17
Windows 11
H2 Priority: Major Reporter: Kai Zander (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
Simple criteriaBuilder.exists(subQuery) conditions don’t work anymore under 6.1.2, while
they worked under 5.6.10, the following exception is thrown:
org.hibernate.query.sqm.InterpretationException: Error interpreting query [SqmRoot not yet
resolved to TableGroup] ; this may indicate a semantic (user query) problem or a bug in
the parser [SqmRoot not yet resolved to TableGroup].
I attached a simple example project, extract it and run mvnw test. It is a minimal Spring
Boot project that recreates the data model from Vlad’s blog post
https://vladmihalcea.com/exists-subqueries-jpa-hibernate/ (
https://vladmihalcea.com/exists-subqueries-jpa-hibernate/ ) and issues his example queries
in both JPQL and Criteria variants. The JPQL variant succeeds, the Criteria variant throws
the aforementioned exception.
I encountered this issue while trying to migrate our applications to Hibernate 6, where we
make tons of criteria subqueries.
(
https://hibernate.atlassian.net/browse/HHH-15477#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15477#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100206- sha1:3ac329d )