hibernate3 在提交带有中文参数乱码

hibernate3 在提交带有中文参数的sql语句时会有一个bug.无论你如何转型,提交的sql中,中文始终是乱码

1.
解决方法是,在定义hibernate属性时.加上
<property name="hibernateProperties">
     <prop key="hibernate.query.factory_class">
     org.hibernate.hql.classic.ClassicQueryTranslatorFactory
    </prop>
</props>

2.利用占位符的方式也可避免乱码(不用添加配置的)

这是在spring中管理hibernate的时候的定义格式

你可能感兴趣的:(spring,sql,Hibernate,配置管理)