简体   繁体   English

Hibernate示例忽略大小写而不调用Example.ignoreCase()

[英]Hibernate Example ignores case without calling Example.ignoreCase()

I'm using Hibernate version 4.3.5.Final . 我正在使用Hibernate版本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 (eg "BLAFOO"). 这里的问题是Hibernate找到Foo类型的实体,其中属性address的大小写具有不同的情况(例如“BLAFOO”)。 However, in my example, ex.ignoreCase() is not called. 但是,在我的示例中,不调用ex.ignoreCase()

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

This is probably caused by a case insensitive comparison at the database itself. 这可能是由数据库本身的不区分大小写比较引起的。

Check the character set/collation of your table/database. 检查表/数据库的字符集/排序规则。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM