I want to change a column from a table to uppercase before using like and filtering what is the keyword in HQL?
here's my query
SELECT abc
FROM ABC abc
WHERE abc.id = ?
And upper(abc.description) like '%?%'
Thanks
yes case is working in HQL now (I am using 3.5.
HQL queries are case insensitive; however, the names of Java classes and properties are case-sensitive HQL is used to execute queries against database.
Keywords like SELECT, FROM, and WHERE, etc., are not case sensitive, but properties like table and column names are case sensitive in HQL.
In HQL we perform order by and group by for the given property of entity or associated entities.
HQL supports the upper()
function defined by the EJB 3.0 specification in the SELECT
and WHERE
clauses. From the documentation:
14.10. Expressions
- ...
- Any function or operator defined by EJB-QL 3.0:
substring()
,trim()
,lower()
,upper()
,length()
,locate()
,abs()
,sqrt()
,bit_length()
,mod()
- ...
So the following should work:
from DomesticCat cat where upper(cat.name) like 'FRI%'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With