标签:
首先,必须要创建数据库时,指字某个列为区别大小写:
CREATE TABLE person(
id VARCHAR(32) PRIMARY KEY,
NAME VARCHAR(30) BINARY
);
然后在Hibernate中:
String hql = "from Person where lower(name)=‘jjj‘";
List list = sess.createQuery(hql).list()
System.err.println(list);
list = sess.createCriteria(Person.class).add(Restrictions.eq("name", "jjj").ignoreCase()).list();
标签:
原文地址:http://www.cnblogs.com/alston/p/4760001.html