在搭建springmvc框架时,底层使用hibernate4.1.8,数据库使用mysql5.1,使用hibernate自动生成数据库表时,hibernate方言使用org.hibernate.dialect.MySQLInnoDBDialect,自动生成表时会出现
2012-11-28 08:07:35,210 [org.hibernate.tool.hbm2ddl.SchemaUpdate]-[ERROR] HHH000388: Unsuccessful: create table Test (id
integer not null, createDate datetime not null, name varchar(255) not null, remark varchar(255), primary key (id)) type
=InnoDB
2012-11-28 08:07:35,210 [org.hibernate.tool.hbm2ddl.SchemaUpdate]-[ERROR] You have an error in your SQL syntax; check th
e manual that corresponds to your MySQL server version for the right syntax to use near 'type=InnoDB' at line 7
后来,网上查找一番,发现是因为type=InnoDB在5.0以前是可以使用的,但5.1之后就不行了。如果我们把type=InnoDB改为engine=InnoDB就不会有这个问题。但是,我想使用Hibernate,自动帮我建表,怎么办呢。这就与我们指定的数据库方言(dialect)有关了。
之前我的配置是:
现在改为: