Hibernate is used for fuzzy query. the parameter passed on the page also handles the garbled @ Action (value & quot; searchNameByad & quot;) publicStringsearchNameByad () throwsException {System. out. println (& quot; android sends the request to get the parameter: & quot; + buildingname); solve the garbled problem StringbnnewString (buildingname. getBytes (& quot; iso-88 server mysql remote connection hibernate
Hibernate is used for fuzzy query, and the parameters passed on the page are also garbled.
@ Action (value = "searchNameByad ")
Public String searchNameByad () throws Exception {
System. out. println ("The parameter obtained by the android sending request is:" + buildingname );
// Solve the garbled problem
String bn = new String (buildingname. getBytes ("iso-8859-1"), "UTF-8 ");
List buildings = buildingService. getByName (bn );
In the local test, data can be found by passing Chinese parameters, but after being uploaded to the server, the Chinese parameters cannot be found. only numbers and English words can be found. I used a local remote connection to the server database, and the data was not found by Chinese parameters... You can also query the database on the server .. Solution
This is the hql statement after the local remote connection to the server database
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 '% Guang %'