How to use the entity query framework to model the following query
We have a query which needs to check if a certain integer field points is not null and if appointmentDate is before current date? How do I write the restrictions expression for the above scenario?
@Entity
public class User {
...
Integer 开发者_开发知识库points;
Date appointmentDate;
...
}
If using Hibernate
<framework:hibernate-entity-query name="requiredList" scope="conversation" ejbql="from User u where u.appointmentDate < current_date and u.points is not null"/>
If using JPA
<framework:entity-query name="requiredList" scope="conversation" ejbql="from User u where u.appointmentDate < current_date and u.points is not null"/>
精彩评论