hibernate4鏈接mysql自動建立表之錯誤

最近一個項目用的ssh,我從svn上checkout項目以後啓動(配置的是hibernate.hbm2ddl.auto=update),結果表沒有自動生成(表不存在),而後看控制檯,控制檯提示建立表失敗,把建立語句拿出來是:mysql


HHH000388: Unsuccessful: create table t_user (user_id bigint not null auto_increment, card_number varchar(30), card_type varchar(20), company_name varchar(200), email varchar(100), gender varchar(100) not null, identity varchar(20), job_name varchar(60), mobile varchar(30) not null, password varchar(100) not null, real_name varchar(100) not null, primary key (user_id)) type=InnoDBsql

2014-11-10 10:27:10,749 ERROR (org.hibernate.tool.hbm2ddl.SchemaUpdate:237) - 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 14數據庫

2014-11-10 10:27:10,756 ERROR (org.hibernate.tool.hbm2ddl.SchemaUpdate:236) - HHH000388: Unsuccessful: create table t_word (word_id bigint not null auto_increment, content longtext not null, create_date datetime, modify_date datetime, title varchar(100) not null, author_id bigint, primary key (word_id)) type=InnoDBssh

2014-11-10 10:27:10,763 ERROR (org.hibernate.tool.hbm2ddl.SchemaUpdate:237) - 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 9ide

2014-11-10 10:27:10,767 ERROR (org.hibernate.tool.hbm2ddl.SchemaUpdate:236) - HHH000388: Unsuccessful: create table t_wordreply (reply_id bigint not null auto_increment, content longtext not null, reply_date datetime, replier_id bigint, word_id bigint, primary key (reply_id)) type=InnoDBsvn


能夠看到自後都是type=InnoDB,網上搜索了以後,原來是type=InnoDB 是5.0以前使用的,個人數據庫是5.5的spa

這個時候須要把hibernate中mysql的方言改一下,hibernate

原來的:hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialectserver

改爲:hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialectrem

相關文章
相關標籤/搜索