from User u where upper(u.name) = upper('Smith');
This HQL will select users whose name like 'Smith','smith','SMITH' and so on.
Also you can use Criteria. First create Criteria with Restrictions.
Strings equal match using Restrictions.eq('name','Smith'
Strings fuzzy match using Restrictions.ilike('name','Smith') or Restrictions.like('name','Smith).ignoreCase()
We do not recommand using Criteria, because the string will be convert in every matching, has a poor performance.
2. Query ignore case in oracle sql
Different database has its own way to deal with string case. Oracle is a case sensitive database.
If you wanna query ignore case, there are upper() and lower() functions you can use.
Select * from user where upper(name) = upper('Smith');
Posted in: