Subquery using derived table in Hibernate HQL
问题 I have a Hibernate HQL question. I'd like to write a subquery as a derived table (for performance reasons). Is it possible to do that in HQL? Example: FROM Customer WHERE country.id in (SELECT id FROM (SELECT id FROM Country where type='GREEN') derivedTable) (btw, this is just a sample query so don't give advice on rewriting it, is just the derived table concept I'm interested in) 回答1: Unfortunately no, derived tables don't currently work in HQL. For example, the following works: List<int>