如何在hibernate中编写子查询

时间:2010-09-07 16:22:18

标签: hibernate

我有SQL查询,我不知道怎么写hibernate

select lp.lnprdtname,la.lid,la.step 
from mfic.lnapp as la 
left join mfic.lnprdt as lp on lp.lnprdtid in 
    (select lnprdtid from mfic.lnapp where lid in 
        (select lid from mfic.lnbrwr where brwrid in 
            (select brwrid from mfic.brwr where uid=1)))
where la.lid in 
    (select lid from mfic.lnbrwr where brwrid in 
        (select brwrid from mfic.brwr where uid=1));

1 个答案:

答案 0 :(得分:1)

如上所述: Chapter 14. HQL: The Hibernate Query Language - 14.13. Subqueries

from DomesticCat as cat
where cat.name not in (
    select name.nickName from Name as name
)
     

请注意,HQL子查询只能出现在select或where子句中。

无论如何,我不确定在一个声明中连接这么多子查询是个好主意......