As "Ashish" said, hibernate only allows the use of operators like "||", but it is not on the JPQL syntax. So i just found that the function to concatenate it using JPQL was CONTATENATE(feld1, field2), if anyone have the same issue as me.
Eclipse showing error in correct NamedQuery syntax
-
25-06-2023 - |
문제
i have a problem with eclipse, i have this query that works fine using createQuery, but as i am converting all my "createQuery" to named queries i get this error:
The part of code where i wrote this:
(c.contaNumero || c.contaNumeroDigito)
is to concatenate two fields and match this concatenation with the user input.
As i said, this is a correct query, i just think eclipse or JBoss tools is showing an incorrect error message... How can i solve this?
-------EDIT-------
I just found the answer to this, i posted it here but i can only accept it after 2 days from today (WTF?).
해결책 3
다른 팁
|| is no operator in JPQL. Replace it with OR: http://docs.oracle.com/cd/E11035_01/kodo41/full/html/ejb3_langref.html#ejb3_langref_operators
Why you have error:
As mentioned by Mr. Ray ||
is not a operator in JPQL
so you have to replace it with 'OR'
Why you are able to run is with session:
Hibernate allow use arithmetic operators, concatenation, and recognized SQL functions in the select clause:
mentioned here