解决hibernate+mysql写入数据库乱码
-
原创
-
2016-06-07 18:01:40
720浏览
初次没习hibernate,其中遇到问题在网上找的答案与大家共同分享!
hibernate.cfg.xml加上属性.
trueUTF-8mysql 的驱动用3.0.15以上版本的,
加个Filter, 使用UTF-8字符集就可以了,
若使用Spring则写在spring中的sessionFactory里即可。
例如:
BR>"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
root
jdbc:mysql://localhost:3306/hibernate_table
org.hibernate.dialect.MySQLDialect
mySql hibernatetable
12345678
com.mysql.jdbc.Driver
true
UTF-8
true
true
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。