使用Hibernate会生成哪种类型的查询?

时间:2018-12-06 08:39:45

标签: java hibernate

据我所知,当使用休眠标准API生成sql时,将在本机sql之前生成特定于对象模型查询语言的查询。

但是会生成什么样的查询。是HQL还是JPQL?

可以配置吗?

它是否取决于数据库?

设置“ hibernate.show.sql = true”时从控制台输出的示例:

Hibernate: 
    /* SELECT
        o 
    FROM
        MuhasebeBirimi o 
    WHERE
        o.muhasebeBirimiVergiNo=:parameter1 */ select
            muhasebebi0_.ID as ID1_41_,
            muhasebebi0_.VERSION as VERSION2_41_,
            muhasebebi0_.CREATION_TS as CREATION3_41_,
            muhasebebi0_.UPDATE_TS as UPDATE_T4_41_,
            muhasebebi0_.ADI as ADI5_41_,
            muhasebebi0_.IL_ID as IL_ID9_41_,
            muhasebebi0_.ILCE_ID as ILCE_ID10_41_,
            muhasebebi0_.DURUM as DURUM6_41_,
            muhasebebi0_.MUHASEBE_BIRIMI_NO as MUHASEBE7_41_,
            muhasebebi0_.MUHASEBE_BIRIMI_VERGI_NO as MUHASEBE8_41_ 
        from
            MUHASEBE_BIRIMI muhasebebi0_ 
        where
            muhasebebi0_.MUHASEBE_BIRIMI_VERGI_NO=?
Hibernate: 
    /* SELECT
        DISTINCT o 
    FROM
        Etiket o 
    WHERE
        (
            o.muhasebeBirimiId IS NULL 
            OR o.muhasebeBirimiId=:parameter1
        ) 
    ORDER BY
        o.id DESC */ select
            distinct etiket0_.ID as ID1_13_,
            etiket0_.VERSION as VERSION2_13_,
            etiket0_.CREATION_TS as CREATION3_13_,
            etiket0_.UPDATE_TS as UPDATE_T4_13_,
            etiket0_.ACIKLAMA as ACIKLAMA5_13_,
            etiket0_.ADI as ADI6_13_,
            etiket0_.ETIKET_KAYNAGI as ETIKET_K7_13_,
            etiket0_.ETIKET_TURU as ETIKET_T8_13_,
            etiket0_.MUHASEBE_BIRIMI_ID as MUHASEBE9_13_ 
        from
            ETIKET etiket0_ 
        where
            etiket0_.MUHASEBE_BIRIMI_ID is null 
            or etiket0_.MUHASEBE_BIRIMI_ID=? 
        order by
            etiket0_.ID DESC limit ?

0 个答案:

没有答案