hibernate mysql concat 查询 结果 乱码

来源:互联网 发布:linux ntp与ntpdate 编辑:程序博客网 时间:2024/05/19 18:42

  String sql="select Meeting_Room_Guid, Meeting_Room_Name,"+
   "CONCAT('aaaa',cast(sum(case when Begin_Time between 1437408000000 and 1537408000000 and meeting_type=10 then 1 else 0 end) as CHAR),'个',"+
   "'bbbb',cast(sum(case when Begin_Time between 1437408000000 and 1537408000000  and meeting_type=20 then 1 else 0 end) as CHAR),'个') as A "+
  "from  cccc  group by Meeting_Room_Guid"; 
        
         SQLQuery query = getSession().createSQLQuery(sql.toString());     
         List<Object[]> list= query.list();

 

 

如上面的语句,如果 concat中有 字符串和数字,hibernate中 查询返回值 就有问题

 

需要将其中的数字 cast一下,然后concat就ok了。

0 0