I want to write following query as NamedQuery
in Eclipselink
select o from user o where trunc(o.TRSF_DATE) = ?1 and o.contrno in(?2,?3,?4,?5,?6,?7,?8,?9,?10,?11)
I am getting following error
Internal Exception: NoViableAltException(83!=[661:1: simpleConditionalExpressionRemainder[Object left] returns [Object node] : (n= compariso
nExpression[left] | (n1= NOT )? n= conditionWithNotExpression[(n1!=null), left] | IS (n2= NOT )? n= isExpression[(n2!=null), left] );])
at org.eclipse.persistence.exceptions.JPQLException.unexpectedToken(JPQLException.java:372)
Regards,
My guess is that the error is caused by trunc, which is not a valid JPQL function. In EclipseLink you can use the FUNC keyword to call a database function.
See, http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Querying/Support_for_Native_Database_Functions