当前位置:Gxlcms > mysql > 服务器-hibernate操作mysql,模糊查询时中文查不到,数字和英文可以查到

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

时间:2021-07-01 10:21:17 帮助过:39人阅读

服务器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 '%广%'

人气教程排行