# Issue with Hibernate 6.4 for an HQL

**URL:** <https://discourse.hibernate.org/t/issue-with-hibernate-6-4-for-an-hql/9516>\
**Category:** Hibernate ORM\
**Created:** [May 14, 2024, 8:49pm UTC](https://discourse.hibernate.org/t/issue-with-hibernate-6-4-for-an-hql/9516 "2024-05-14T20:49:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![2011ashwini](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/2011ashwini/32/3481_2.png) [@2011ashwini](https://discourse.hibernate.org/u/2011ashwini)\
**Post date:** [May 14, 2024, 8:49pm UTC](https://discourse.hibernate.org/t/issue-with-hibernate-6-4-for-an-hql/9516/1 "2024-05-14T20:49:32Z")

</div>

I have an HQL which worked fine prior to Hibernate 6, after upgrading to hibernate 6.4 now I am getting below exception  
org.hibernate.query.SemanticException: Operand of - is of type ‘java.lang.Integer’ which is not a temporal amount it is not an instance of ‘java.time.TemporalAmount’  
sample query which is causing this issue  
createDate \<(SYSDATE- 120 SECOND)  
the database is oracle and createDate datatype is Timestamp

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [May 15, 2024, 7:21am UTC](https://discourse.hibernate.org/t/issue-with-hibernate-6-4-for-an-hql/9516/2 "2024-05-15T07:21:16Z")

</div>

Try putting parenthesis around the temporal amount i.e. `createDate < current_timestamp - (120 second)`

---

<div class="post-metadata">

**Author:** ![brandon698sherrick](https://avatars.discourse-cdn.com/v4/letter/b/3be4f8/32.png) [@brandon698sherrick](https://discourse.hibernate.org/u/brandon698sherrick)\
**Post date:** [May 20, 2024, 11:28am UTC](https://discourse.hibernate.org/t/issue-with-hibernate-6-4-for-an-hql/9516/3 "2024-05-20T11:28:21Z")

</div>

To [kynect](https://www-kynect.com)@2011ashwini ,

To resolve this issue, you can adjust your HQL query to correctly handle date arithmetic in a way that Hibernate 6.4 understands. Option 1 is Use SQL Functions. Hibernate provides access to SQL functions directly in HQL queries, which can be used to perform date arithmetic. Option 2 is Use Hibernate’s INTERVAL Function (if supported). Some versions of Hibernate support the INTERVAL function for defining date intervals directly in HQL.
