【问题标题】:JPA where clause conditionJPA where 子句条件
【发布时间】:2014-10-09 06:46:48
【问题描述】:

我在 hbm.xml 文件的这个映射中使用休眠 3:

<class table="mtl_material_transactions" 
        name="com.kaka.oracle.model.inventory.transactions.MaterialTransaction" 
        where="transaction_type_id in (35,44,90)" 
        schema="apps">

关键是where,我怎么能和JPA 2.0一样(hibernate 4.1.9 final as provider)

【问题讨论】:

    标签: java hibernate jpa


    【解决方案1】:

    可以使用@where注解,详情见此链接:

    Hibernate @Where clause

    例如,您的实体如下所示:

    @Entity
    @Table(name = "mtl_material_transactions", schema="apps")
    @Where(clause="transaction_type_id in (35,44,90)")
    public class MaterialTransaction {
       ...
    }
    

    【讨论】:

    • 谢谢,你节省了我的时间。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-01-27
    • 2013-10-11
    • 1970-01-01
    • 2015-05-15
    • 2014-09-30
    • 1970-01-01
    • 2018-02-06
    相关资源
    最近更新 更多