hibernate create自動建立表異常問題

Hibernte中的hibernate.hbm2ddl.auto設置成create,讓Hibernate幫助自動建表,但不成功,報以下信息:mysql

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'type=InnoDB' at line 1sql

    個人mysql 數據庫是5.7版本的,因此要改變方言,由於:type=InnoDB在5.0之前是能夠使用,但5.1以後就不行了。數據庫

  若是把type=InnoDB改成engine=InnoDB就不會有這個問題。spa

可是想使用Hibernate,自動建表就須要將:hibernate

<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>server

改成:io

<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>error

相關文章
相關標籤/搜索