I want to know if JPQL is capable of doing a case-insensitive search on a collection of string.
Scenario:
Table1:
Column1 (int) | Column2(string)
1 ABC
2 XYZ
I am looking for a JPQL query which does something like this
from Table1 a where upper(a.column2) in upper(:listOfCol2Values)
Can I achieve this without having to change the case at the application code where i set the collection.
Cheers.
No you cannot. Reason is that UPPER and LOWER operate to the strings, so they do not take collection as argument.
You can always do :
from Table1 a where (upper(a.column2) = upper(:value1)
or upper(a.column2) = upper(:value2)
or ...)
来源:https://stackoverflow.com/questions/9178290/jpa-case-insensitive-in-clause-for-a-list-of-string-values