zoukankan      html  css  js  c++  java
  • [转]实体类与数据库字段不匹配问题,java.sql.SQLSyntaxErrorException: Unknown column 'xxx' in 'field list'

    控制台报错
    
    ### 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'

  • 相关阅读:
    卖家必须了解的库存数据,亚马逊库存报告都帮你整理好了
    Genymotion 无法安装 APK 解决方案
    这张系统架构图画的漂亮!
    IT项目风险大全
    ElasticSearch是一个基于Lucene的搜索服务器
    商业模式的定义、商业模式的好坏
    如何实现互联网+业务与IT的融合
    UBUNTU PHP 版本切换
    Ubuntu为PHP安装SOAP扩展
    实现Linux下的ls -l命令
  • 原文地址:https://www.cnblogs.com/rainbow70626/p/14304261.html
Copyright © 2011-2022 走看看