Caused by: org.apache.ibatis.reflection.ReflectionException我碰到的情况,原因不唯一
映射文件:
<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我碰到的情况,原因不唯一相关推荐
- org.apache.ibatis.reflection.ReflectionException: Error instantiating class with invalid types
大家好,我是烤鸭,记录一个初级异常,百度搜索结果不多: Caused by: org.apache.ibatis.reflection.ReflectionException: Error insta ...
- Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException: There is no gette
这里写自定义目录标题 问题起因 错误码代码如下: step 1 问题起因 很简单的id和where mapper标签的使用不知道为什么突然出现无null1getter错误 错误码代码如下: org.a ...
- 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. ...
- ?????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 ...
- 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 ...
- 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 ...
- 使用mybatisplus的insert方法报错:org.apache.ibatis.reflection.ReflectionException: Could not set property
使用mybatisplus的insert方法报错:org.apache.ibatis.reflection.ReflectionException: Could not set property 'i ...
- 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 ...
- 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 ...
最新文章
- python3 __import__ 简介
- react封装函数_React-Router源码解读
- c++ reference counting引用计数原理
- 阿里妈妈是如何做品牌风险管理的
- QIPAIFANS网站程序【2013最新版】
- svn报错:This error was generated by a custom hook script on the Subversion server.
- OpenShift Security (2) - 安装 Red Hat Advanced Cluster Security(RHACS)
- blur失焦方法会触发两次_教程 | ARAMIS光学测量系统散斑制作与光学应变测量方法...
- 第0章 Oracle的安装及相关配置
- Nginx服务器学习(一)CentOS7系统安装Nginx
- 密码学知识-加密介绍-1
- 【PyTorch深度学习项目实战100例】—— 基于UNet实现血管瘤超声图像分割 | 第30例
- 单例模式只会懒汉饿汉?读完本篇让你面试疯狂加分
- win10系统 删掉自带的输入法
- JedisConnectionException: Could not get a resource from the pool
- 23个部门联合发文:加快5G网络等信息基础设施建设和商用步伐,推动车联网部署应用...
- 模拟“嫦娥五号”探月小游戏【附源码】
- 坑 -- h5获取用户当前定位
- 码讯化工人员定位系统/支持无线WiFi|UWB定位
- 查看笔记本SN序列号
热门文章
- 数据导出之sqlserver-导出脚本
- MyBatis框架学习 DAY_02:使用XML配置文件/多参数问题 / FOREACH /IF / #{}和${} / 创建SSM框架流程
- 网络数据包信息收集工具ferret-sidejack
- C#开发Unity游戏教程之判断语句
- 微型计算机分析,微机原理练习题分析
- 虚拟服务器nodejs项目部署打包,nodejs+express搭建服务器及vue项目部署打包
- visual c++ 6.0原版_C/C++编程笔记:C语言函数指针的理解与使用,就是这么简单明了!...
- scss安装_安装了这9个免费PS插件后,终于能正常时间下班了……
- jforum oracle报错,JForum安装在Oracle数据库上
- java上传png_java图片上传