日期:2014-05-17  浏览次数:20852 次

hibernate 查询语句
今天看到 hibernate 的find方法打印的sql语句,很奇怪,为什么一个select语句可以嵌入另一select语句 

from里面呢,我知道的这种情况应该是子查询,不都应该嵌入到where查询条件中的吗?有懂的大牛帮我解析一下啊,感激不尽!
控制台答应的语句如下:

Hibernate:

    select
        * 
    from
        ( select
            distinct tkcbh0_.KCBHID as KCBHID36_,
            tkcbh0_.CKDID as CKDID36_,
            tkcbh0_.CKRK as CKRK36_,
            tkcbh0_.CREATEDBY as CREATEDBY36_,
            tkcbh0_.CREATEDTIME as CREATEDT3_36_,
            tkcbh0_.CRKSJ as CRKSJ36_,
            tkcbh0_.CRKSL as CRKSL36_,
            tkcbh0_.CZR as CZR36_,
            tkcbh0_.DElETEDBY as DElETEDBY36_,
            tkcbh0_.DELETEDFLAG as DELETEDF6_36_,
            tkcbh0_.DELETEDTIME as DELETEDT7_36_,
            tkcbh0_.MODIFIEDBY as MODIFIEDBY36_,
            tkcbh0_.MODIFIEDTIME as MODIFIED8_36_,
            tkcbh0_.RKDID as RKDID36_,
            tkcbh0_.WZID as WZID36_ 
        from
            t_kcbh tkcbh0_ 
        where
            (
                tkcbh0_.DELETEDFLAG=0 
            )
            and(
                tkcbh0_.WZID=? 
            ) 
        order by
            tkcbh0_.CRKSJ desc ) 
    where
        rownum <= ?

------解决方案--------------------
from里面的叫内联视图、好像
------解决方案--------------------
引用:
今天看到 hibernate&n