Subquery using derived table in Hibernate HQL

Posted by Vladimir on Stack Overflow See other posts from Stack Overflow or by Vladimir
Published on 2010-03-12T15:26:48Z Indexed on 2010/03/12 15:27 UTC
Read the original article Hit count: 737

Filed under:
|
|

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 advices on rewriting it, is just the derived table concept I'm interested in) Thanks.

© Stack Overflow or respective owner

Related posts about hql

Related posts about derived