映射文件:

<select id="selectKeyByUserId"  resultMap="Xxx">
        <![CDATA[
        SELECT * FROM 表名1
         where 1=1
            <if test="userId!=0">
            and ID=#{userId,jdbcType=NUMERIC}) 
            </if>
    </select>

dao层

public List<Xxx> selectKeyByUserId(long userId);

Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'userId' in 'class java.lang.Long'
    at org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:380)
    at org.apache.ibatis.reflection.MetaClass.getGetInvoker(MetaClass.java:170)
    at org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:152)
    at org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:48)
    at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:116)
    at org.apache.ibatis.scripting.xmltags.DynamicContext$ContextMap.get(DynamicContext.java:97)
    at org.apache.ibatis.scripting.xmltags.DynamicContext$ContextAccessor.getProperty(DynamicContext.java:116)
    at org.apache.ibatis.ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1657)
    at org.apache.ibatis.ognl.ASTProperty.getValueBody(ASTProperty.java:92)
    at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
    at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:210)
    at org.apache.ibatis.ognl.ASTNotEq.getValueBody(ASTNotEq.java:49)
    at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
    at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:210)
    at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:333)
    at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:413)
    at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:395)
    at org.apache.ibatis.scripting.xmltags.OgnlCache.getValue(OgnlCache.java:48)
    at org.apache.ibatis.scripting.xmltags.ExpressionEvaluator.evaluateBoolean(ExpressionEvaluator.java:32)
    at org.apache.ibatis.scripting.xmltags.IfSqlNode.apply(IfSqlNode.java:33)
    at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:32)
    at org.apache.ibatis.scripting.xmltags.DynamicSqlSource.getBoundSql(DynamicSqlSource.java:40)
    at org.apache.ibatis.mapping.MappedStatement.getBoundSql(MappedStatement.java:278)
    at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:75)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:108)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)

... 89 more

出现原因
 这里出现的问题是在DAO方法中定义的参数 与 实体中定义的属性不一致 导致的。

解决方案:

dao层加@Param("userId")注解即可

public List<DictItem> selectKeyByUserId(@Param("userId") long userId);

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

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

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

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

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

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

    进行Spring整合Mybatis时,发生的Bug: 看Log: org.mybatis.spring.MyBatisSystemException: nested exception is org. ...

  4. ?????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 ...

  5. 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 ...

  6. 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 ...

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

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

  8. T.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.Reflectio

    There is no getter for property named '*' in 'class java.lang.String',此错误之所以出现,是因为mybatis在对parameter ...

  9. Caused by: org.apache.ibatis.builder.BuilderException: Error evaluating expression ‘dept.name

    Caused by: org.apache.ibatis.builder.BuilderException: Error evaluating expression 'dept.name != nul ...

最新文章

  1. python3 __import__ 简介
  2. react封装函数_React-Router源码解读
  3. c++ reference counting引用计数原理
  4. 阿里妈妈是如何做品牌风险管理的
  5. QIPAIFANS网站程序【2013最新版】
  6. svn报错:This error was generated by a custom hook script on the Subversion server.
  7. OpenShift Security (2) - 安装 Red Hat Advanced Cluster Security(RHACS)
  8. blur失焦方法会触发两次_教程 | ARAMIS光学测量系统散斑制作与光学应变测量方法...
  9. 第0章 Oracle的安装及相关配置
  10. Nginx服务器学习(一)CentOS7系统安装Nginx
  11. 密码学知识-加密介绍-1
  12. 【PyTorch深度学习项目实战100例】—— 基于UNet实现血管瘤超声图像分割 | 第30例
  13. 单例模式只会懒汉饿汉?读完本篇让你面试疯狂加分
  14. win10系统 删掉自带的输入法
  15. JedisConnectionException: Could not get a resource from the pool
  16. 23个部门联合发文:加快5G网络等信息基础设施建设和商用步伐,推动车联网部署应用...
  17. 模拟“嫦娥五号”探月小游戏【附源码】
  18. 坑 -- h5获取用户当前定位
  19. 码讯化工人员定位系统/支持无线WiFi|UWB定位
  20. 查看笔记本SN序列号

热门文章

  1. 数据导出之sqlserver-导出脚本
  2. MyBatis框架学习 DAY_02:使用XML配置文件/多参数问题 / FOREACH /IF / #{}和${} / 创建SSM框架流程
  3. 网络数据包信息收集工具ferret-sidejack
  4. C#开发Unity游戏教程之判断语句
  5. 微型计算机分析,微机原理练习题分析
  6. 虚拟服务器nodejs项目部署打包,nodejs+express搭建服务器及vue项目部署打包
  7. visual c++ 6.0原版_C/C++编程笔记:C语言函数指针的理解与使用,就是这么简单明了!...
  8. scss安装_安装了这9个免费PS插件后,终于能正常时间下班了……
  9. jforum oracle报错,JForum安装在Oracle数据库上
  10. java上传png_java图片上传