在用hibernate自动生成表的时候发现报如下错误
org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:213) You have an error in your SQL syntax; check the manual that corresponds to yourMySQL server version for the right syntax to use near 'type=InnoDB' at line 7
工作中使用sql语句建表时,发现如下错误:
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 line7
二、解决方案:
这个报错是由于某些版本的mysql不支持type写法,将type关键词改成ENGINE 即可。
- org.hibernate.dialect.MySQLInnoDBDialect(mysql5.0以前使用)
- org.hibernate.dialect.MySQL5InnoDBDialect(mysq5.1-5.5)
或者直接写成
- org.hibernate.dialect.MySQLDialect