mybatis------调错了方法 Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException
测试结果为:
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'username' in 'class java.lang.Integer'### Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'username' in 'class java.lang.Integer'
XML为UserDao.xml
测试类为:
总结是:测试时,调用错了mybatis的查询方法,检查问题时没有细致的检查代码,导致在小错误上花费了半个小时。
出现这个错误是${只能是value} 是字符串拼接不防sql注入,并且大括号里是value不变;#{这里面随便什么字符都可以} 并且防SQL注入
正确的XML为: