In my study of hibernate, I encountered an error: The JUnit test passed, but the database did not create a table, the console error message is as follows:
HHH000388:Unsuccessful:create table T_user (user_id bigint not NULL auto_increment, Card_number varchar (+), Card_type V Archar (), company_name varchar (+), email varchar (+), gender varchar (+) NOT NULL, identity varchar (+), job_name VA Rchar, Mobile varchar (+) NOT NULL, password varchar (+) NOT NULL, Real_name varchar (+) NOT NULL, PRIMARY key (user _id)) Type=innodb
2014-11-10 10:27:10,749 Error (org.hibernate.tool.hbm2ddl.schemaupdate:237)-You have a error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use-near ' type=innodb ' on 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 (+) NOT NULL, author_id bigint, primary key (word_id)) Type=innodb
2014-11-10 10:27:10,763 Error (org.hibernate.tool.hbm2ddl.schemaupdate:237)-You have a error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use-near ' type=innodb ' on line 9
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, wor d_id bigint, primary key (reply_id)) Type=innodb
Can see from after all is Type=innodb, after searching on the net, originally is Type=innodb is used before 5.0, my database is 5.5
This time we need to change the dialect of MySQL in Hibernate,
Original: Hibernate.dialect=org.hibernate.dialect.mysqlinnodbdialect
Change to: Hibernate.dialect=org.hibernate.dialect.mysql5innodbdialect
HIBERNATE4 connection MySQL auto create table error