在Hibernate配置文件中加入下面代碼:
<property name="
hibernate.query.factory_class">
org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
如果是Spring+Hibernate開發,則在定義Hibernate配置屬性時候加入:
<property name="
hibernateProperties">
<props>
<prop key="
hibernate.query.factory_class">
org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>
</props>
</property>
設定數據庫連接方式是UTF-8。例如連接MYSQL時配置URL如下:這是在hibernate.cfg.xml文件里設置:jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8或加兩個屬性
<property name="connection.useUnicode">true</property>
<property name="connection.characterEncoding">UTF-8</property>
注意,上述寫法是hibernate的hibernate.cfg.xml寫法.最后要注意的是在tomcat中&要寫成&即可。
posted on 2006-09-15 13:26
周銳 閱讀(867)
評論(3) 編輯 收藏 所屬分類:
Hibernate