hibernate error record - hibernate primary key generation strategy results in Column 'id' cannot be null

Configuration file snippet:

<id name="id">

<generator class="native"></generator>

</id>

Error details:

Hibernate: insert into student (id, name) values (null, ?)

hibernate.exception.ConstraintViolationException: could not insert: [fh.model.Student]

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'id' cannot be null

Solutions;

hibernate.exception.ConstraintViolationException: Primary key constraint exception!

The primary key id of the table student is not caused by automatic growth!

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326797986&siteId=291194637