Hibernate自动生成数据表后,里面数据乱码问题

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" >
<hibernate-configuration>
  <session-factory>
    <!-- 配置方言 -->
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <!-- 配置数据库驱动类 -->
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <!-- 数据库访问路径 -->
    <property name="hibernate.connection.url"> jdbc:mysql://127.0.0.1:3306/hibernate?useUnicode=true&amp;characterEncoding=UTF-8</property>
    <!-- 用户名 -->
    <property name="hibernate.connection.username">root</property>
    <!-- 密码 -->
    <property name="hibernate.connection.password"></property>
   
    <property name="hbm2ddl.auto">update</property>
    <!-- 是否在控制台显示产生的SQL语句信息 -->
    <property name="show_sql">true</property>
   
    <!-- 管理加载映射文件 -->
    <mapping resource="com/shxt/model/User.hbm.xml"/>
 
 
  </session-factory>
</hibernate-configuration>

猜你喜欢

转载自norret.iteye.com/blog/2283967