Tarator
Tarator

Reputation: 1524

Hibernate Example ignores case without calling Example.ignoreCase()

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);

Upvotes: 5

Views: 275

Answers (1)

Jimmy T.
Jimmy T.

Reputation: 4190

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

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

Upvotes: 1

Related Questions