2

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;
...
}
0

1 Answer 1

4

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.