进行Spring整合Mybatis时,发生的Bug;

看Log:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'uesrName' in 'class com.smbms.pojo.User'at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)at com.sun.proxy.$Proxy6.selectList(Unknown Source)at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)at com.smbms.pojo.UserMapperImpl.getUserList(UserMapperImpl.java:14)at com.smbms.pojo.UserServiceImpl.findUsersWithConditions(UserServiceImpl.java:11)at com.smbms.pojo.UserServiceImpTest.test(UserServiceImpTest.java:21)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at java.lang.reflect.Method.invoke(Unknown Source)at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)at org.junit.runners.ParentRunner.run(ParentRunner.java:363)at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'uesrName' in 'class com.smbms.pojo.User'at org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:409)at org.apache.ibatis.reflection.MetaClass.getGetInvoker(MetaClass.java:164)at org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:162)at org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:49)at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:122)at org.apache.ibatis.executor.BaseExecutor.createCacheKey(BaseExecutor.java:219)at org.apache.ibatis.executor.CachingExecutor.createCacheKey(CachingExecutor.java:146)at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:82)at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at java.lang.reflect.Method.invoke(Unknown Source)at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)... 28 more

解决:自己写的BUG:There is no getter for property named 'uesrName' in 'class com.smbms.pojo.User',写错单词。

(1)select标签的sql语句,与映射实体类的成员变量对应不上:

 <select id="getUserList" parameterType="com.smbms.pojo.User" resultMap="userlist">select u.* ,r.roleName from smbms_user,u smbms_role rwhere u.userName like CONCAT('%',#{uesrName},'%')and u.userRole = #{userRole} and u.userRole = r.id</select>  

(2)从报错的“no getter for property ”可知:这个对应关系是通过getter()方法访问器得到的。

 private String userName;public String getUserName() {return userName;}public void setUserName(String userName) {this.userName = userName;}

FAQ(31):org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'ues相关推荐

  1. org.apache.ibatis.reflection.ReflectionException: There is no getter for property named XXX

    org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.Reflecti ...

  2. ?????nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for pr

    ?????nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for pr ...

  3. nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for propert

    nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for propert ...

  4. 使用mybatisplus的insert方法报错:org.apache.ibatis.reflection.ReflectionException: Could not set property

    使用mybatisplus的insert方法报错:org.apache.ibatis.reflection.ReflectionException: Could not set property 'i ...

  5. 【JavaWeb学习报错集(一)】ReflectionException:There is no getter for property named XXX

    在学习JavaWeb的Mybatis章节时,使用的是Mybatis的Mapper代理开发,在练习时出现了下面这种错误 先介绍下整体代码:(如果很熟悉代码,直接跳到最后看报错原因分析) 利用Mybati ...

  6. Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException: There is no gette

    这里写自定义目录标题 问题起因 错误码代码如下: step 1 问题起因 很简单的id和where mapper标签的使用不知道为什么突然出现无null1getter错误 错误码代码如下: org.a ...

  7. Caused by: org.apache.ibatis.reflection.ReflectionException我碰到的情况,原因不唯一

    映射文件: <select id="selectKeyByUserId"  resultMap="Xxx">         <![CDATA ...

  8. org.apache.ibatis.reflection.ReflectionException: Error instantiating class with invalid types

    大家好,我是烤鸭,记录一个初级异常,百度搜索结果不多: Caused by: org.apache.ibatis.reflection.ReflectionException: Error insta ...

  9. FAQ(43): com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL sy

    2018/1/3 spring对Mybatis整合, 看Log: org.springframework.jdbc.BadSqlGrammarException: ### Error querying ...

最新文章

  1. 2020上半年收集到的优质AI文章 – AI+和+AI
  2. 11.18 Apache用户认证 11.19/11.20 域名跳转 11.21 Apache访问日志
  3. 堆溢出攻击(XP SP2 - 2003)
  4. 每天一个linxu命令6之jps  查看java进程的端口
  5. 全市场等权中位数_A股市场周内效应研究
  6. JSP小项目,会员管理系统之实现注册功能
  7. MyEclipse的快捷使用(含关联源码和Doc的方式)
  8. windows源码安装apache2 win安装apache 阿帕奇服务器
  9. java4选择结构 二
  10. JavaScript的预编译过程分析
  11. 在WinForm中回车键(enter)和Esc键的设置
  12. 中国水煤浆行业“十四五”规划与运营模式分析报告2022~2028年
  13. 轻量级程序编辑器的选择:EmEditor、Editplus等---Web开发系列之工具篇
  14. c++ opencv保存图片
  15. ssh免密报错:Could not resolve hostname : Name or service not known
  16. CS61A Proj 3
  17. 软件设计师之法律法规知识
  18. OpenCV4教程——3.3 绘制直线
  19. 配置并检验 S1 上的 SSH 访问
  20. 《数学之美(第一版)》笔记整理 —— 目录

热门文章

  1. 什么是模板模板参数?
  2. 异步电机(感应电机)模型预测电流控制仿真模型,框架为双闭环矢量控制,电流环为模型预测电流控制器
  3. 计算机显示没有可以的ip地址,我的电脑的IP地址显示不出来怎么办
  4. ❤️动态爱心代码合集❤️
  5. STM32: 利用高级定时器产生6路互补PWM波形输出在BLDC中H-PWM-L-ON驱动方式下驱动无刷电机
  6. 模糊pid和神经网络pid对比,神经网络pid控制率计算
  7. 腾讯Bugly集成(简单好用!)
  8. uart的后续,控制开发板按键,并且与led进行联系
  9. BZOJ 2423: [HAOI2010]最长公共子序列
  10. ps切片导出时将切片选项选择为“所有用户切片”