<!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>
<!-- 一、 数据库连接的参数配置 -->
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/app?useUnicode=true&characterEncoding=utf8</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- 二、 hibernate其他常用配置 -->
<property name="hibernate.show_sql">true</property><!--
<property name="hibernate.format_sql">true</property>
--><property name="hibernate.hbm2ddl.auto">update</property>
<!-- 三、加载映射文件
<mapping resource="cn/itcast/a_status/Employee.hbm.xml"/>-->
<mapping resource="entity/User.hbm.xml"/>
</session-factory>
</hibernate-configuration>
1,url要加上utf-8,不加会出现
Unknown initial character set index '255' received from server. Initial client character
解决:https://blog.csdn.net/txwtech/article/details/80787886