Hibernate error: Column ' ID ' cannot be null

Source: Internet
Author: User
Tags sql error

Error content:

17:21:59,843 INFO org.hibernate.tool.hbm2ddl.schemaexport:226-running HBM2DDL schema Export
17:21:59,859 DEBUG org.hibernate.tool.hbm2ddl.schemaexport:242-import File not found:/import.sql
17:21:59,859 INFO org.hibernate.tool.hbm2ddl.schemaexport:251-exporting generated schema to database
17:21:59,859 DEBUG org.hibernate.tool.hbm2ddl.schemaexport:377-drop table Longmao if exists
17:21:59,859 DEBUG org.hibernate.tool.hbm2ddl.schemaexport:362-unsuccessful:drop table Longmao if exists
17:21:59,859 DEBUG Org.hibernate.tool.hbm2ddl.schemaexport:363-you has an error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use near ' if exists ' at line 1
17:21:59,859 DEBUG org.hibernate.tool.hbm2ddl.schemaexport:377-create table Longmao (ID integer generated by default as Identity (start with 1), name varchar (255), primary key (ID))
17:21:59,859 ERROR org.hibernate.tool.hbm2ddl.schemaexport:348-unsuccessful:create table LongMao (ID integer Generated by default as identity (start with 1), name varchar (255), primary key (ID))
17:21:59,859 Error Org.hibernate.tool.hbm2ddl.schemaexport:349-you has an error in your SQL syntax; Check the manual that corresponds to your MySQL server version for the right syntax to use near ' generated by default as I Dentity (start with 1), name varchar (255), primary key ' @ Line 1
17:21:59,859 INFO Org.hibernate.tool.hbm2ddl.schemaexport:268-schema Export Complete
Hibernate:insert into Longmao (ID, name) VALUES (NULL,?)
17:21:59,953 WARN org.hibernate.util.jdbcexceptionreporter:100-sql error:1048, sqlstate:23000
17:21:59,953 ERROR org.hibernate.util.jdbcexceptionreporter:101-column ' id ' cannot be null

----------------------------

Modified to:

<!--SQL dialect--
<property name= "dialect" >org.hibernate.dialect.MySQLDialect</property>

Note: MySQL is spelled like this, the second letter is lowercase

It is recommended to go directly to the document copy, don't knock Yourself


Hibernate error: Column ' ID ' cannot be null

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.