解决hibernate+mysql写入数据库乱码

WBOY
Release: 2016-06-07 18:01:40
Original
946 people have browsed it

初次没习hibernate,其中遇到问题在网上找的答案与大家共同分享!

hibernate.cfg.xml加上属性.
true
UTF-8
mysql 的驱动用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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!