There is no getter for property named...

本文详细解析了一个关于MyBatis更新操作时出现的系统异常问题,具体表现为XML配置文件中的条件判断语句因拼写错误导致的运行时异常。通过分析错误堆栈信息及对应的XML配置代码,找到了问题的根源并给出了修正方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

错误信息

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'nul' in 'class com.qinsfu.param.AdminParam'

引起该错误的原因就是xml中的参数没有在你定义的Mapper的方法实数中找到属性的映射,至于我的引起原因如下:

<update id="update">
    update tb_admin
    <include refid="updatePart"/>
    <where>
        <choose>
            <when test="id != nul">id=#{id}</when>
            <otherwise>account=#{account}</otherwise>
        </choose>
    </where>
</update>

可以看到我把null打成了null,然后他误以为这个nul是在我的mapper中被提供的参数,然后他却没有在我的对应参数对象中找到对应nul属性的getter,也就是 There is no gettert for property named 'nul' in 'XXXX'.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值