如何使用实体查询框架对以下查询进行建模

发布于 2024-09-16 17:39:38 字数 167 浏览 4 评论 0原文

我们有一个查询需要检查某个整数字段点是否不为空以及约会日期是否在当前日期之前?对于上述场景,如何编写限制表达式呢?

@Entity
public class User {

...
Integer points;
Date appointmentDate;
...
}

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

桃气十足 2024-09-23 17:39:38

如果使用 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"/>

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"/>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文