报错的具体信息:
ERROR: HHH000388: Unsuccessful: create table NEWS (ID integer not null auto_increment, TITLE varchar(255), AUTHOR varchar(255), DATE datetime, primary key (ID)) type=InnoDB
二月 11, 2017 6:08:08 下午 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
二月 11, 2017 6:08:08 下午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000232: Schema update complete
Hibernate:
insert
into
NEWS
(TITLE, AUTHOR, DATE)
values
(?, ?, ?)
二月 11, 2017 6:08:08 下午 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
WARN: SQL Error: 1146, SQLState: 42S02
二月 11, 2017 6:08:08 下午 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: Table 'hibernate5.news' doesn't exist
原因: MySQL的版本跟当前方言配置属性不一致
解决方法:
<property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
改成:
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>