Reputation: 1378
I have the following query, which is working when I use it directly at the db:
@NamedQuery(name = "Sentitems.findWhereSendingDateTimeIsYesterdayByStatus",
query = "SELECT s FROM Sentitems s WHERE s.status = :status AND DATE_FORMAT(s.sendingDateTime, '%Y-%m-%d') = SUBDATE(CURDATE(),1)")
When running the application, a NoViableAltException
is thrown:
Exception Description: Syntax error parsing the query [Sentitems.findWhereSendingDateTimeIsYesterdayByStatus: SELECT s FROM Sentitems s WHERE s.status = :status AND DATE_FORMAT(s.sendingDateTime, '%Y-%m-%d') = SUBDATE(CURDATE(),1)], line 1, column 66: unexpected token [(].
Internal Exception: NoViableAltException(83@[()* loopback of 383:9: (d= DOT right= attribute )*])
Upvotes: 0
Views: 1500
Reputation: 908
Try with @NamedNativeQuery
. You seem to be using some DB specific syntax.
Upvotes: 1
Reputation: 1378
Like Balaji Krishnan said in the comments, the solution is to use @NamedNativeQuery
instead of @NamedQuery
.
Upvotes: 0