0
votes

I'm using hibernate for the data access layer,
so i have to write HQL query for the following SQL query.

select * from MyTable where my_date >= '16-SEP-2012'

It is working fine.. For this i have written HQL query as follows,

From MyTable as NB where NB.my_date >=date

It is throwing an error..

From MyTable as NB where NB.my_date >=Mon Mar 07 00:00:00 IST 1 org.hibernate.hql.ast.QuerySyntaxException: unexpected token: Mar

How to write HQL query for this.. Any Idea?

1

1 Answers

0
votes

Try :date, since your current code is a syntax error. If it still doesn't work, try using a yyyy-MM-dd format - it might be a locale issue. Also be sure to set the parameter properly, you Did not include that part of your code.