用from Profile pro where pro.school like ?");
也是一样的效果。
出现乱码。

解决方案 »

  1.   

    你的jsp文件使用gbk编写的吗?
    就是你的编辑器的编码方式
      

  2.   

    <%@ page contentType="text/html;charset=gbk"%>
      

  3.   

    现在乱码已经解决。
    可为什么查不到值呢?
    12:13:44,671  INFO SessionFactoryImpl:353 - Checking 0 named HQL queries
    12:13:44,671  INFO SessionFactoryImpl:373 - Checking 0 named SQL queries
    Hibernate: select profile0_.id as id0_, profile0_.UserId as UserId0_, profile0_.
    registerTime as register3_0_, profile0_.sex as sex0_, profile0_.school as school
    0_, profile0_.department as department0_, profile0_.enterTime as enterTime0_, pr
    ofile0_.dorm as dorm0_, profile0_.highSchool as highSchool0_, profile0_.homeCity
     as homeCity0_, profile0_.homeProvice as homePro11_0_, profile0_.birthday_year a
    s birthday12_0_, profile0_.birthday_month as birthday13_0_, profile0_.birthday_d
    ay as birthday14_0_ from profile profile0_ where (profile0_.school like ? )
    12:13:44,859 DEBUG StringType:79 - binding '%大学%' to parameter: 1上面是log4j输出的?
    可查不到结果。
    用mysql> select * from profile where (school like '%大学%');在mysql上直接查可以得到13条。奇怪啦??