开发者

Hibernate Criteria Query to outer join sub-queries results

I have a requirement to convert the below SQL query into a criteria query. There is just one table and note that it is not a case for self join.

SELECT atable.c1 AS ac1, btable.c1 as bc1 
  FROM (
       SELECT a.c1 
         FROM table_child a 
        WHERE a.c2='XXX') atable 
       LEFT OUTER JOIN (
           SELECT b.c1 
             FROM table_child b 
            WHERE b.c3 ='YYYYY') btable 
       ON atable.c1 = btable.c1 

I am aware of how to use DetachedCriteria using org.hibernate.criterion.Subqueries to do things like IN(), NOT EXISTS(), etc. But the SubQueries class seems to be mainly for WHERE clause.

How do I use a SubQuery to perform a join as shown in the above SQL query. I need to do this using Hibernate C开发者_Python百科riteria Query.

Thanks.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜