首页  >  文章  >  数据库  >  服务器-hibernate操作mysql,模糊查询时中文查不到,数字和英文可以查到

服务器-hibernate操作mysql,模糊查询时中文查不到,数字和英文可以查到

WBOY
WBOY原创
2016-06-06 09:36:261648浏览

服务器mysql远程连接hibernate

用hibernate做模糊查询,页面传递参数也处理了乱码
@Action(value="searchNameByad")
public String searchNameByad()throws Exception{
System.out.println("android发送请求获取的参数是:"+buildingname);
//解决乱码问题
String bn = new String(buildingname.getBytes("iso-8859-1"),"UTF-8");
List buildings = buildingService.getByName(bn);
在本地测试传中文参数可以查到数据,但是在上传到服务器后,传递中文参数却查不到,只能数字、英文可以查询到结果。我用本地远程连接服务器数据库,也是中文参数查不到数据。。。在服务器上的数据库里操作查询也是可以查的到。。求解
这是本地远程连接服务器数据库后的hql语句
Hibernate: select building0_.buildingid as buildingid11_, building0_.area as area11_, building0_.buildingname as building3_11_, building0_.linkman as linkman11_, building0_.linkphone as linkphone11_, building0_.email as email11_, building0_.qrcode as qrcode11_, building0_.province as province11_, building0_.city as city11_ from airquality.building building0_ where building0_.buildingname like '%广%'

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn