現在の日付をチェックしている状態があります-3。
select * from TABLE_1 SYSDATE-3 >= TABLE_1.created_date
Hibernateクエリ言語でどのように書くべきですか?
Oracle SQLダイアレクトの場合sysdate()
、次の例のように使用します。
select e
from Entity e
where (e.endDate is null or (e.endDate > sysdate()))
orm.xml
これは、を使用する場合に有効です。<named-query>
「過去3日間に作成されていないすべての行」という特定のクエリには、次を使用します。
select e from Entity e where to_date(sysdate() - 3) >= e.created_date
エンティティを使用してHQLを作成する必要があります。
http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html_single/#queryhql-examples
sysdateを使用しているいくつかの例があります。