0

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.

1
  • Could you please provide minimized but complete hql to reproduce your problem. What database do you use? Commented Sep 5, 2020 at 5:21

1 Answer 1

1

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/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.