我们有一个查询需要检查某个整数字段点是否不为空以及约会日期是否在当前日期之前?对于上述场景,如何编写限制表达式?
@Entity
public class User {
...
Integer points;
Date 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"/>
如果使用 JPA
<framework:entity-query name="requiredList" scope="conversation" ejbql="from User u where u.appointmentDate < current_date and u.points is not null"/>
关于hibernate - 如何使用实体查询框架对以下查询进行建模,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3602619/