Abazine Abdellatif
Abazine Abdellatif

Reputation: 61

HIbernate query parameter binding throws QuerySyntaxException

I have this hql query :

... DATE_ADD(p.bar.foo, INTERVAL :param SECOND) < NOW() ...

Hibernate throws this exception :

org.hibernate.hql.ast.QuerySyntaxException: unexpected token: : near line 1, column 715

Hibernate says that the syntax exception is related to :param.

What i wanted to do is just to bind param in a none hql experssion.

Upvotes: 0

Views: 174

Answers (1)

v.ladynev
v.ladynev

Reputation: 19976

Hibernate HQL doesn't have INTERVAL. You can try to use Criteria with native SQL using Restrictions.sqlRestriction()

https://fmdojo.wordpress.com/2014/05/14/native-sql-inside-criteria-hibernate/

Upvotes: 1

Related Questions