HIBERNATE4 connection MySQL auto create table error

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.