mysql 5.5创建表_Hibernate与Mysql 5.5创建表出错

最近在学习hibernate,利用其自动创建表时老是出错,出错信息如下:

ERROR: HHH000388: Unsuccessful: create table NEWS (ID integer not null auto_increment, TITLE varchar(255), AUTHOR varchar(255), DATE date, primary key (ID)) type=InnoDB

2015-12-24 13:50:38 org.hibernate.tool.hbm2ddl.SchemaUpdate execute

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 7

2015-12-24 13:50:38 org.hibernate.tool.hbm2ddl.SchemaUpdate execute

经过分析,可以看出提示在type=InnoDB这里出错,将hibernate自动生成的建表语句

create table NEWS (ID integer not null auto_increment, TITLE varchar(255), AUTHOR varchar(255), DATE date, primary key (ID)) type=InnoDB

在mysql下运行同样报错,经查资料发现是这么一回事:

在mysql 5.0版本以后不支持 type=InnoDB 关键字,需要使用 engine=InnoDB

解决放下如下:

在hinernate.cfg.xml配置文件中修改本地方言即可:

org.hibernate.dialect.MySQL5Dialect

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值