Mybatis报错:There is no getter for property named 'xxxx' in 'class xxxx
程序员文章站
2022-07-15 13:46:18
...
There is no getter for property named ‘xxxx’ in ‘class
java.lang.Integer
这是在百度上查到的,出现多的问题。不是Integer就是String这些,然后百度上一般就是给出这种方案:
如果参数是#{oneParameter},则改成#{_parameter},在接口中定义方法时 增加“@Param(“oneParameter”)” 标记
List selectContent(@Param("contentSize")int contentSize)
- 1
当时我就照着这种方案改的,依旧报错不误,而且
There is no getter for property named ‘oneParameter’ in ‘class xxxx
变成了
There is no getter for property named ‘_parameter’ in ‘class xxxx
我传的是一个model进来,按照这种方式改根本就没用。
这个时候就陷入了僵局,完全不知道怎么去改代码。
**
再仔细看看报错的信息,提示我们少了一个getter方法。那么我们是不是真的就少了这个getter呢?
这个时候更应该去检查我们的model中是不是有某个词写错了。因为当我们定义的这个变量,打错了字母之后,会出现mapper与model对不上的情况(也就是找不到对应的getter)。**
<link rel="stylesheet" href="https://csdnimg.cn/release/phoenix/template/css/markdown_views-ea0013b516.css">
</div>
推荐阅读
-
Mybatis报错:There is no getter for property named ‘xxxx‘ in ‘class xxxx
-
Mybatis报错:There is no getter for property named 'xxxx' in 'class xxxx
-
Mybatis报错:There is no getter for property named ‘xxxx‘ in ‘class xxxx
-
Mybatis报错:There is no getter for property named ‘xxxx‘ in ‘class xxxx
-
There is no getter for property named 'xxx' in 'class java.lang.xxxx'解决办法
-
Mybatis There is no getter for property named 'xxxx' in 'class java.lang.String'
-
Mybatis There is no getter for property named 'XXX' in 'class java.lang.XXX
-
Mybatis报错:There is no getter for property named 'xxxx' in 'class xxxx
-
Mybatis中传参包There is no getter for property named 'XXX' in 'class java.lang.Strin
-
Mybatis-There is no getter for property named 'id' in 'class java.lang.String'