【问题标题】:Convert SQL request to Hibernate Criteria将 SQL 请求转换为 Hibernate Criteria
【发布时间】:2016-01-12 06:08:01
【问题描述】:

我想将此 SQL 转换为任一条件。很抱歉,我不知道使用哪一个,因为我是 Hibernate 的新手。我做了一些研究,看起来两者都需要实现我想要的。

我的 Sql 请求

 select * 
from change.pade pade, change.pade_etat rdp, par.safsit safsit, par.saf saf
where pade.sir = "1245454"
and pade.id_safsit = "1"
and pade.id_safsit = safsit.id
and safsit.cd_s in ("12", "45")
and safsit.fk_saf = saf.id
and saf.cd_ur in "124"
and rdp.fk_pade = pade.id
and rdp.id_etat in "444"

【问题讨论】:

标签: sql hibernate criteria


【解决方案1】:

你可以使用 Hibernate 属性而不是像这样写HQL

session.createSQLQuery(String sqlQuery)

see an example here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-10-08
    • 2012-07-29
    • 1970-01-01
    • 2017-11-03
    • 2020-05-22
    • 2014-03-29
    • 1970-01-01
    相关资源
    最近更新 更多