码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2017-09-11 16:27:32      阅读:599      评论:0      收藏:0      [点我收藏+]

标签:source   sel   erp   for   system   不用   one   报错信息   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

标签:source   sel   erp   for   system   不用   one   报错信息   string   

原文地址:http://www.cnblogs.com/loger1995/p/7505365.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!