hibernate错误记录-hibernate主键生成策略导致Column 'id' cannot be null

配置文件代码段:

错误详情:

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

解决思路;

hibernate.exception.ConstraintViolationException:主键约束异常!

表student主键id不是自动增长导致!

你可能感兴趣的:(hibernate,java,数据库)