Question

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: enter image description here

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?).

Was it helpful?

Solution 3

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top