hibernate mysql 模糊查询_服务器-hibernate操作mysql,模糊查询时中文查不到,数字和英文可以查到...
用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 '%廣%'
總結
以上是生活随笔為你收集整理的hibernate mysql 模糊查询_服务器-hibernate操作mysql,模糊查询时中文查不到,数字和英文可以查到...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql union join_MyS
- 下一篇: mysql collation utf8