Search code examples
hibernatehql

Interval in Hibernate syntax


I would like to query the next sentence in Hibernate:

from Attribute where tDate between ((select max(tDate) from Attribute)-interval '5 minutes') and (select max(tDate) from Attribute)

However, HQL does not understand interval. How could I do this?

Thank you!


Solution

  • Hibernate does not have interval keyword.

    You can rewrite query to use between keyword or you can use native query