HIBERNATE4 connection MySQL auto create table error

Source: Internet
Author: User

Recently a project with SSH, I started from SVN on the Checkout project (configured hibernate.hbm2ddl.auto=update), the result table is not automatically generated (the table does not exist), and then look at the console, the console prompts to create the table failed, To take the creation statement out is:


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 ' 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 (+) 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


you can see from the back . Type=innodb, after searching the internet, it turns out that Type=innodb was used before 5.0, and 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

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.