拼写错误引发的惨案
细心,以后不要犯错
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拼写错误,也提示可能是传入参数,一直在检查类的全路径名 参数类型是否正确,结果是拼写错误,一定要好好看错误提示