zoukankan      html  css  js  c++  java
  • There is no getter for property named 'id' in 'class java.lang.Integer'

    使用mybatis传入参数, 当参数类型是String ,Integer 等这些时。如果用他的<if test="year != null and year != ''">标签判断该参数是否为空,通常会爆There is no getter for property named ‘year’ in ‘class java.lang.Integer异常。

    也就是说如果我们不使用if标签进行判断的时候,只传单个这样的参数,是不会报这个错误的,已经亲测过。

    但是实际上实体类中写了相关的方法,最后找到问题出现在Mapper接口中,

    List<EneElectricity> getProAndLiveByMonth(Integer year);

    注意只需要在mapper层中修改,其它层无需改动,将代码改为:

    List<EneElectricity> getProAndLiveByMonth(@Param(value="year") Integer year);

    问题解决。

  • 相关阅读:
    指针
    显示和隐式转换
    C++虚函数
    字符串输出
    BP神经网络
    超像素分割
    函数putText()在图片上写文字
    compare
    十五、cookies和session的使用
    爬取腾讯社招职位信息
  • 原文地址:https://www.cnblogs.com/wanlige/p/13278233.html
Copyright © 2011-2022 走看看