关于HQL参数中含有中文是乱码的解决方法

关于HQL参数中含有中文是乱码的解决办法
在spring+hibernate中:Hql中有中文参数(如from test as c where c.name=''张三'')的话被翻译成sql的时候会出现乱码,解决办法是在application.xml中加入以下语句:

<prop key="hibernate.query.factory_class">  

    org.hibernate.hql.classic.ClassicQueryTranslatorFactory   

</prop> 



在struts+hibernate中

hibernate的配制文件hibernate.cfg.xml中加入

<property name="query.factory_class">
        org.hibernate.hql.classic.ClassicQueryTranslatorFactory
</property>