进行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. linux的翻译系统开发,Linux系统下的翻译神器——Goldendict
  2. Linux进程浏览器htop安装与使用
  3. gcc编译C++程序
  4. PLSQL Developer中几个功能
  5. Effective Java之优先使用标准的异常(六十)
  6. plupload使用例子
  7. 解决Git Log在IDEA中乱码的问题
  8. Oracle tips
  9. python并发处理机制_Python并发编程—同步互斥
  10. python 【递归 及 二分法】
  11. TMEA:源于音乐,高于盛典
  12. 第19篇:关于近期cs服务端被反打的原因分析
  13. deepin,真好用-09-deepin真垃圾
  14. python列表平均值的算法_python计算一个序列的平均值的方法
  15. 母亲节祝福html源码,有创意的母亲节祝福语大全
  16. 医学统计学计算机操作课后答案,医学统计课后习题答案.doc
  17. [转载]谈谈我对攻读计算机研究生的看法
  18. Codeforces 1155F Delivery Oligopoly dp(看题解)
  19. Chrome 谷歌浏览器下载网页中的背景图、图标等
  20. 墨魂服务器维修,2013年10月22日定期维护公告

热门文章

  1. 【FI】新总账功能—平行分类账配置
  2. 计算机毕业设计Java高校微后勤服务平台(源码+系统+mysql数据库+Lw文档)
  3. php表白情话,情人节这些表白文案都帮你准备好了,就怕你还没对象(捂脸)
  4. 软件测试——面试八股文(入门篇)
  5. 九号机器人田奇峰_小米生态链企业最新力作,九号机器人智能电动车,电摩中的特斯拉...
  6. Nginx自建CDN以及ngx_cache_purge清除缓存
  7. SQL语句基本的查询命令操详细总结
  8. 指针和引用总结(详细,易懂,全面,直观)
  9. 记录好用的电脑工具/软件
  10. 日结算 java_建设银行支付接口,按日期查询已结算订单xml接口解析(JAVA版) | 学步园...