There is no getter for property named 'xxx' in 'class java.lang.String

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了There is no getter for property named 'xxx' in 'class java.lang.String相关的知识,希望对你有一定的参考价值。

报错信息:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named investTime in class java.lang.String
    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:76)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:399)
    at com.sun.proxy.$Proxy30.selectOne(Unknown Source)
    at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:165)
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:69)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)
    at com.sun.proxy.$Proxy36.mokuUserTotalAmount(Unknown Source)

错误写法:

<if test="investDate!=null and investDate!=‘‘">
    AND invest.addtime LIKE CONCAT(%,#{investDate},%)
</if>

正确写法:

<if test="_parameter!=null and _parameter!=‘‘">
      AND invest.addtime LIKE CONCAT(%,#{_parameter},%)
</if>

总结:

如果不用if test来判断的话,不管哪种写法都不会报错!建议都用_parameter来写,多参数用Map或者封装一个bean来做参数

以上是关于There is no getter for property named 'xxx' in 'class java.lang.String的主要内容,如果未能解决你的问题,请参考以下文章

mybatis出现There is no getter for property named ...的原因及解决办法

There is no getter for property named 'NULL' in ……

Mybatis单个参数报错: There is no getter for property named

Mybatis单个参数报错: There is no getter for property named

Mybatismybatis查询报错org.apache.ibatis.reflection.ReflectionException: There is no getter for propert(代

Mybatis单个参数的if判断(针对异常:There is no getter for property..)------mybatis的内置对象