hibernate 5 与 mysql 5.7 以上 版本的 坑

来源:互联网 发布:百度软件开发笔试 编辑:程序博客网 时间:2024/05/22 13:08
<?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.7 以上版本专有 -->  <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>

按照上面写就对了