mybatis出现There is no getter for property named ...的原因及解决办法
Posted chenry777
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mybatis出现There is no getter for property named ...的原因及解决办法相关的知识,希望对你有一定的参考价值。
环境
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.2.0</version>
</dependency>
原因:
出现这问题的原因是用mybatis写xml文件时,后端传的是单独一个的值,并且在xml文件做了对值if判断,就出现了这种现象,经过分析可以发现是在<if test="">
里面获取不到传入的参数值
解决办法:
方法1:mapper接口参数上使用@param(value="")
进行参数名的指定
方法2:在xml文件中使用_parameter代替参数名
方法3:取消xml中的<if test="">
判断
后续
感觉上可能是一个mybatis3的bug,待追踪一下官方issue后补充更新
以上是关于mybatis出现There is no getter for property named ...的原因及解决办法的主要内容,如果未能解决你的问题,请参考以下文章
mybatis 异常 There is no getter for property named 'bizId' in 'class java.lang.Long'(示
mybatis There is no getter for property named 'xxxx
Mybatis 报错 There is no getter for property named '***' in 'class java.lang.String'(示
There is no getter for property named xxx' in 'class java.lang.xxx'
Mybatis单个参数的if判断(针对异常:There is no getter for property..)------mybatis的内置对象