【问题标题】:How to use the entity query framework to model the following query如何使用实体查询框架对以下查询进行建模
【发布时间】:2010-08-30 17:13:07
【问题描述】:

我们有一个查询,需要检查某个整数字段点是否不为空,以及约会日期是否早于当前日期?上述场景的限制表达式怎么写?

@Entity
public class User {

...
Integer points;
Date appointmentDate;
...
}

【问题讨论】:

    标签: hibernate orm jpa seam hql


    【解决方案1】:

    如果使用休眠

    <framework:hibernate-entity-query name="requiredList" scope="conversation" ejbql="from User u where u.appointmentDate < current_date and u.points is not null"/>
    

    如果使用 JPA

    <framework:entity-query name="requiredList" scope="conversation" ejbql="from User u where u.appointmentDate < current_date and u.points is not null"/>
    

    【讨论】:

      猜你喜欢
      • 2017-03-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多