- 情感问答
- 答案列表
hql 模糊查询:hql模糊查询语句[朗读]
这样一个list,里面存放的是多个employee对象.然后我想对这个list进行按照employee对象的名字进行模糊查询.有什么好的解决方案么?比如我输入的查询条件为“wang”,那么应该返回只包含employee1的list列表.listlist=newarraylist();employeeemployee1=newemployee();employee1.setname("wangqiang");employee1.setage(30);list.add(employee1);
updateusersetmale=(casenamewhen小姐then女when女士then女else男end)如果模糊匹配'小姐'比如有'张小姐'updateusersetmale=(casewhencharindex('小姐',name)>0then女whencharindex('女士,name)>0then女else男end)。
把字符串一个个取出来用or
stringhql="fromgoods.scwheresc.titlelike'%"+name+"%'";改下:stringhql="fromgoodsasscwheresc.titlelike'%'"+name+"'%'";
既然是模糊查询机没有必要给转成日期型的数据了select*fromeducateastwheret.begintimelike%值%。