测试结果为:

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'


mybatis------调错了方法 Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException

XML为UserDao.xml

mybatis------调错了方法 Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException

测试类为:

mybatis------调错了方法 Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException


总结是:测试时,调用错了mybatis的查询方法,检查问题时没有细致的检查代码,导致在小错误上花费了半个小时。

出现这个错误是${只能是value} 是字符串拼接不防sql注入,并且大括号里是value不变;#{这里面随便什么字符都可以} 并且防SQL注入


正确的XML为:

mybatis------调错了方法 Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
  • 2021-08-24
  • 2021-12-14
  • 2021-05-22
  • 2021-05-01
猜你喜欢
  • 2021-10-24
  • 2021-12-16
  • 2021-10-22
  • 2021-04-12
  • 2021-12-03
  • 2021-05-07
  • 2022-03-07
相关资源
相似解决方案