我有检查当前日期- 3的条件。
select * from TABLE_1 SYSDATE-3 >= TABLE_1.created_date我应该如何用Hibernate查询语言编写?
发布于 2012-04-25 05:37:00
您需要使用您的实体编写HQL。
http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html_single/#queryhql-examples
这里有一些使用sysdate的例子。
发布于 2013-05-01 07:04:19
对于Oracle SQL方言,使用sysdate(),如下例所示:
select e
from Entity e
where (e.endDate is null or (e.endDate > sysdate()))这对于orm.xml或使用<named-query>时有效
对于您的特定查询“过去三天内尚未创建的所有行”,请使用以下命令:
select e from Entity e where to_date(sysdate() - 3) >= e.created_datehttps://stackoverflow.com/questions/10306166
复制相似问题