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/ 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. |