2021-12-15 15:29:50.983 ERROR 5340 --- [nio-8081-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:
### Error updating database. Cause: java.sql.SQLException: Column count doesn't match value count at row 1
### The error may exist in file [E:demotargetclassesmapperStudentMapper.xml]
### The error may involve com.example.stu.demo.tao.StudentMapper.addStudent-Inline
### The error occurred while setting parameters
### SQL: insert into student values (?,?,?,?)
### Cause: java.sql.SQLException: Column count doesn't match value count at row 1
; bad SQL grammar []; nested exception is java.sql.SQLException: Column count doesn't match value count at row 1] with root cause
图一是实体类中包含的属性,图二是数据库student表中的字段
由于数据库student表中多了一个"psw"字段,会出现Column count doesn't match value count at row 1错误
解决办法:把“psw"字段删除
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)