我们有一个查询,需要检查某个整型字段points是否不为空,以及appointmentDate是否在当前日期之前?如何编写上述场景的约束表达式?
@Entity
public class User {
...
Integer points;
Date appointmentDate;
...
}发布于 2010-08-31 02:07:11
如果使用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"/>https://stackoverflow.com/questions/3602619
复制相似问题