2010-08-30 25 views
2

我们有一个查询需要检查某个整数字段点是否为空,并且如果appointmentDate在当前日期之前?如何为上述场景编写限制表达式?使用Hibernate如何使用实体查询框架为以下查询建模

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

@Entity 
public class User { 

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

回答

4

如果如果使用JPA

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