拼写错误引发的惨案

细心,以后不要犯错

1、Mybatis select查询

映射文件的sql语句:

selsect * from user where username like '%${user.username}%' and sex=#{user.sex}

报错:

org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  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 'selsect * from user where username like '%小%' and sex='1'' at line 1
### The error may exist in mapper/UserMapper.xml
### The error may involve mapper.UserMapper.findUserByVo-Inline
### The error occurred while setting parameters
### SQL: selsect * from user where username like '%小%' and sex=?
### 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 'selsect * from user where username like '%小%' and sex='1'' at line 1

提示selsect拼写错误,也提示可能是传入参数,一直在检查类的全路径名 参数类型是否正确,结果是拼写错误,一定要好好看错误提示

 

posted on 2019-04-08 09:18  王甜甜的小摩托  阅读(144)  评论(0编辑  收藏  举报

导航