Intellij 集成mybatis 查询的时候错误

报告 sql 语法错误,

把生成的代码,贴到sqlyog里运行,也提升错误

原因是 sql里用了sql的关键字,如lock。

    from tbl_admin
    where id = 1‘ at line 3
### The error may exist in file [D:\OneDrive\project\activiti\target\classes\mapper\AdminMapper.xml]
### The error may involve cn.taotao.dao.AdminMapper.selectByPrimaryKey-Inline
### The error occurred while setting parameters
### SQL: select            id, username, password, email, lock, birth         from tbl_admin     where id = ?
### Cause: java.sql.SQLSyntaxErrorException: 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 ‘lock, birth
   
    from tbl_admin
    where id = 1‘ at line 3
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: 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 ‘lock, birth

 

 错误中已经提到 near ‘ lock ,birth, from tbl_admin  where id =1 ‘.....

这里的错误,原因是 lock 是关键字,改为其他即可。弄了半个下午

Intellij 集成mybatis 查询的时候错误

上一篇:在浏览器如何验证xpath语法?


下一篇:10.基本控件 ToolBar