开发者

How to use the entity query framework to model the following query

开发者 https://www.devze.com 2023-01-13 13:32 出处:网络
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?

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"/>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号