Peter Kósa
Peter Kósa

Reputation: 11

QueryDSL 4.x subqueries in the FROM clause

Are subqueries in the from clause supported in the latest QueryDSL version? I tried my best but could not find a solution for now.

Upvotes: 0

Views: 744

Answers (1)

Ido Salomon
Ido Salomon

Reputation: 215

This is not a QueryDSL issue, but a JPQL limitation. Support for subqueries exists only for Select and Where clauses. From the Hibernate documentation:

Note that HQL subqueries can occur only in the select or where clauses.

You need to use native queries if you wish to utilize subqueries in that fashion. For example, see JPA subquery in from clause for query migration. QueryDSL supports native queries, so the principles should be translatable.

Upvotes: 1

Related Questions