Search code examples
javajpajpql

`TO_CHAR not supported`in jpql


When I am running JPQL NamedQuery it gives rror Like:

Syntax error parsing [SELECT empolyee.value From Empolyee empolyee where empolyee.nameId= :value1 and empolyee.indicator='org_id' and TO_CHAR(empolyee.startDate,'YYYY-MM-DD')<= :value2 and (empolyee.endDate is null OR TO_CHAR(empolyee.endDate,'YYYY-MM-DD')>= :value3)]. The right expression is not a valid expression.

I think error is in TO_CHAR it is not supported by JPA is there any option for TO_CHARin JPQL


Solution

  • Thank you YCF_L

    OPERATOR work for me..

    OPERATOR('ToChar', empolyee.startDate,'YYYY-MM-DD')<= :value1