Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate Example ignores case without calling Example.ignoreCase()

Tags:

java

hibernate

I'm using Hibernate version 4.3.5.Final. The problem here is that Hibernate finds entities of the type Foo where the case of the property address has different a case (e.g. "BLAFOO"). However, in my example, ex.ignoreCase() is not called.

I only want to find entities which match the exact case. What am i doing wrong?

Foo myBean = new Foo();
myBean.setAddress("blaFoo");
Example ex = Example.create(myBean);
ex.excludeZeroes();
//ex.ignoreCase();
DetachedCriteria crit = DetachedCriteria.forClass(Foo.class).add(ex);   
List<MonitoredApp> apps = dao.findByDetachedCriteria(crit);
like image 874
Tarator Avatar asked Nov 10 '22 06:11

Tarator


1 Answers

This is probably caused by a case insensitive comparison at the database itself.

Check the character set/collation of your table/database.

like image 164
Jimmy T. Avatar answered Nov 14 '22 23:11

Jimmy T.