Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有什么方法可以用 JPA 或 Hibernate Crtiteria API 来表示这种 SQL 吗?或者我应该以原生方式执行它?
SELECT AX FROM (SELECT X, E.id FROM Employee E) as A WHERE A.id = 10
从文档中:
请注意,HQL 子查询只能出现在 select 或 where 子句中。
所以是的,这样的查询只能使用本机 SQL 来完成。