向 数据库中插入数据报错: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

在这里插入图片描述
原因
数据库建表时主键id未设为自增列的错误,只要在Auto Incr?下勾上就可以对数据库做数据添加插入操作了。
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/LJN951118/article/details/82900547