码迷,mamicode.com
首页 > 数据库 > 详细

实体类与数据库字段不匹配问题,java.sql.SQLSyntaxErrorException: Unknown column 'xxx' in 'field list'

时间:2019-08-06 14:06:26      阅读:2467      评论:0      收藏:0      [点我收藏+]

标签:llb   java   status   was   mamicode   ESS   控制   color   map   

控制台报错

### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: Unknown column ‘user_name‘ in ‘field list‘
### The error may exist in panfeng/mapper/StudentMapper.java (best guess)
### The error may involve panfeng.mapper.StudentMapper.selectByPrimaryKey-Inline
### The error occurred while setting parameters
### SQL: SELECT id,user_name,password,email  FROM student  WHERE  id = ?
### Cause: java.sql.SQLSyntaxErrorException: Unknown column ‘user_name‘ in ‘field list‘
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Unknown column ‘user_name‘ in ‘field list‘] with root cause

java.sql.SQLSyntaxErrorException: Unknown column ‘user_name‘ in ‘field list‘
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) ~[mysql-connector-java-8.0.16.jar:8.0.16]
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.16.jar:8.0.16]

 

浏览器报错

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Tue Aug 06 13:10:39 CST 2019
There was an unexpected error (type=Internal Server Error, status=500).
### Error querying database. Cause: java.sql.SQLSyntaxErrorException: Unknown column ‘user_name‘ in ‘field list‘ ### The error may exist in panfeng/mapper/StudentMapper.java (best guess) ### The error may involve panfeng.mapper.StudentMapper.selectByPrimaryKey-Inline ### The error occurred while setting parameters ### SQL: SELECT id,user_name,password,email FROM student WHERE id = ? ### Cause: java.sql.SQLSyntaxErrorException: Unknown column ‘user_name‘ in ‘field list‘ ; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Unknown column ‘user_name‘ in ‘field list‘

 

出错的时候

 技术图片

 

修改之后,修改之后重启,就可以正常访问了!!!

 技术图片

 

实体类与数据库字段不匹配问题,java.sql.SQLSyntaxErrorException: Unknown column 'xxx' in 'field list'

标签:llb   java   status   was   mamicode   ESS   控制   color   map   

原文地址:https://www.cnblogs.com/taopanfeng/p/11308316.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!