1. 程式人生 > >hibernate 5 與 mysql 5.4 以上 版本的 坑

hibernate 5 與 mysql 5.4 以上 版本的 坑

<?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>
  <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
  <property name="hibernate.connection.password">123456</property>
  <property name="hibernate.connection.url">jdbc:mysql://127.0.0.1:3306/mvc</property>
  <property name="hibernate.connection.username">root</property>
  <!-- mysql5.4 以上版本專有 -->
  <property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
  <property name="hibernate.show_sql">true</property>
  <property name="hibernate.format_sql">true</property>
  <property name="hibernate.hbm2ddl.auto">update</property>
  <!-- 不要預設的 class -->
  <mapping  resource="com/jingshan/model/Student.hbm.xml"/>
 </session-factory>
</hibernate-configuration>