出现这个指示错误
org.springframework.dao.DataIntegrityViolationException:
### Error updating database. Cause: java.sql.SQLException: Field 'id' doesn't have a default value
### The error may involve com.wkcto.plus.mapper.UserMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO user ( name, email, age ) VALUES ( ?, ?, ? )
### Cause: java.sql.SQLException: Field 'id' doesn't have a default value
; Field 'id' doesn't have a default value; nested exception is java.sql.SQLException: Field 'id' doesn't have a default value
深究其原因
字段’id’没有默认值; 嵌套异常是java.sql.SQLException:字段’id’没有默认值也就是数据库的设计问题而不是代码问题
方法解决
数据库的主键位置
要设置一个自增的功能才可实现代码执行
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)