zoukankan      html  css  js  c++  java
  • 使用数据库关键字做字段引起的mybatis或tk.mybatis框架报错

    报错信息:

    Exception Error:

    Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘require ) VALUES( 1,‘xx’,‘dfs’,‘sdf’,‘sdfds’,0 )’ at line 1
    ; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘require ) VALUES( 1,‘xx’,‘dfs’,‘sdf’,‘sdfds’,0 )’ at line 1

    解决方案:

    1.mybatis映射文件中写Sql的时候在关键字加转义符号

    例如字段:

    name     应该写成   `name`
    require  应该写成   `require`
    

    2.tk.mybatis增加注解指定字段加转义符号

    @Column(name = "`require`")
    private Integer require;
    @Column(name = "`name`")
    private Integer name;
    
  • 相关阅读:
    vue基础04计算属性
    vue基础01条件渲染
    vue基础14vuex
    其他03动态拼接地址,使用本地的图片不显示
    其他05vue中ref
    HTML基础02CSS
    其他12es6...运算符
    其他11依赖注入
    其他07插槽
    其他06js类型判断
  • 原文地址:https://www.cnblogs.com/javakfz/p/13938199.html
Copyright © 2011-2022 走看看