类似于HQL的运算符,用于不区分大小写的搜索 [英] HQL like operator for case insensitive search

查看:131
本文介绍了类似于HQL的运算符,用于不区分大小写的搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Jquery实现自动完成功能,当我键入名称时,它将从db中获取记录.db中存储的记录是大写字母&的混合.小写字母.我编写了一个HQL查询,该查询以区分大小写的方式获取记录,但无论大小写,我都需要记录.这是查询,

I am implementing an autocomplete functionality using Jquery, when I type the name, it fetches the record from the db, The records stored in db are mixture of capital & small letters. I have written a HQL Query which fetches me the records with case-sensitive, but I need to records irrespective of case. Here is the query,

List<OrganizationTB> resultList = null;
Query query = session.createQuery("from DataOrganization dataOrg where dataOrg.poolName   
like '%"+ poolName +"%'");
resultList =  query.list();    

Ex:如果我有池名称,HRMS数据集,Hrms数据,Hr数据等...如果键入HR或hr,则需要获取所有3条记录,而我无法.

Ex : If I have pool names, HRMS Data set, Hrms Data, Hr data etc... if I type HR or hr I need to get all the 3 records, which I'm not able to.

请帮助...

推荐答案

将查询更改为

"from DataOrganization dataOrg where lower(dataOrg.poolName)   
like lower('%"+ poolName +"%')"

有关更多信息,请参阅14.3 文档

for more information have a look 14.3 doc

这篇关于类似于HQL的运算符,用于不区分大小写的搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆