hibernate作为项目中的持久层,其中比较方便的就是自动生成数据表,但是在配置文件中需要使用方言来进行配置。在mysql中有三个方言,分别是 org.hibernate.dialect.MySQLDialect、org.hibernate.dialect.MySQLInnoDBDialect和org.hibernate.dialect.MySQLMyISAMDialect,其中InnoDB和ISAMD分别表示mysql中的两种引擎,(具体的差别可以参考http://blog.sina.com.cn/s/blog_67600b6e0102v6iz.html)。
通过三种方言的名称可以知道org.hibernate.dialect.MySQLInnoDBDialect和org.hibernate.dialect.MySQLMyISAMDialect继承于org.hibernate.dialect.MySQLDialect。
在进行自动生成数据表的时,如果使用org.hibernate.dialect.MySQLInnoDBDialect方言则会发生以下错误
3089 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - Unsuccessful: create table employee (id integer not null, name varchar(255), email varchar(255), hiredate datetime, primary key (id)) type=InnoDB
3089 [main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax