我们有一个查询,需要检查某个整数字段点是否为空,以及约会日期是否在当前日期之前?如何为上述场景编写限制表达式?
@Entity
public class User {
...
Integer points;
Date appointmentDate;
...
}
答案 0 :(得分:4)
如果使用Hibernate
<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"/>