hibernate3.0中文查询问题解决方法

在applicationContext.xml中加入如下代码:

  <property name="hibernateProperties">
   <props>
    <prop key="hibernate.dialect">
     org.hibernate.dialect.SQLServerDialect
    </prop>
    <prop key="hibernate.query.factory_class">
     org.hibernate.hql.classic.ClassicQueryTranslatorFactory
    </prop>
   </props>
  </property>

HQL语句:

String hql = "from Cheliang as t where t.cpHaoma like '"+cpHaoma+"'";

你可能感兴趣的:(Hibernate,xml)