向 数据库中插入数据报错:Servlet.service() for servlet [springmvc] in context with path [/ssmtest] threw excepti

错误
Servlet.service() for servlet [springmvc] in context with path [/ssmtest] threw exception [Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException:

Error updating database. Cause: java.sql.SQLException: Field ‘empno’ doesn’t have a default value

向 数据库中插入数据报错:Servlet.service() for servlet [springmvc] in context with path [/ssmtest] threw excepti_第1张图片
原因
数据库建表时主键id未设为自增列的错误,只要在Auto Incr?下勾上就可以对数据库做数据添加插入操作了。
向 数据库中插入数据报错:Servlet.service() for servlet [springmvc] in context with path [/ssmtest] threw excepti_第2张图片

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