关于MySQL版本与HIbernate版本不匹配的问题,注意事项!!

关于MySQL版本问题注意事项MySQL5InnoDBDialect  

报错信息error: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 1

这是因为type=InnoDB在5.0以前是可以使用的,但5.1之后就不行了。其实我们把type=InnoDB改为engine=InnoDB就可以了。修改如下:

  <!-- 数据库方言配置 org.hibernate.dialect.MySQLDialect (选择最短的) -->

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

特别注意MySQL5InnoDBDialect中的5!!

再次运行,完美.

猜你喜欢

转载自blog.csdn.net/lewyu521/article/details/78559383