hibernate的数据库乱码问题

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                                         "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
 <session-factory name="">
  <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
  <!-- 解决中文乱码问题:使用"?useUnicode=true&amp;characterEncoding=UTF-8",不可分行书写 -->
  <property name="hibernate.connection.url">
   jdbc:mysql://localhost:3306/pf?useUnicode=true&amp;characterEncoding=UTF-8
  </property>
  <property name="hibernate.connection.username">opfo</property>
  <property name="hibernate.connection.password">opfo.cn</property>
  <property name="hibernate.connection.pool_size">5</property>
  <property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
  <property name="hbm2ddl.auto">update</property>
  <property name="show_sql">true</property>
  <property name="hibernate.show_sql">true</property>
  <mapping resource="cn/opfo/app/domain/Person.hbm.xml" />
 </session-factory>
</hibernate-configuration>

原文地址:https://www.cnblogs.com/flycatnet/p/5161573.html