How to query ignore case with hibernate

1) If you are using HQL, you can use function lower and upper.

from User u where
upper( = 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'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');

Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email