项目场景:
在项目中使用swagger向表中添加数据
问题描述:
例如:报以下错误
### Error updating database. Cause: java.sql.SQLException: Field 'subject_parent_id' doesn't have a default value
### The error may involve com.atguigu.eduservice.mapper.EduCourseMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO edu_course ( id, teacher_id, subject_id, title, price, lesson_num, cover, gmt_create, gmt_modified ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: java.sql.SQLException: Field 'subject_parent_id' doesn't have a default value
原因分析:
提示:数据库表中这个字段没有设置非空或者自增