Reputation: 23913
Is there some way to represent this kind of SQL with JPA or Hibernate Crtiteria API? Or shall I execute it as native?
SELECT A.X FROM (SELECT X, E.id FROM Employee E) as A WHERE A.id = 10
Upvotes: 1
Views: 498
Reputation: 692121
From the documentation:
Note that HQL subqueries can occur only in the select or where clauses.
So yes, such a query can only be done using native SQL.
Upvotes: 1