There is no getter for property named 'insurance_id' in 'class studio.geek.entity.StudentInsurance'

There is no getter for property named 'insurance_id' in 'class studio.geek.entity.StudentInsurance'

这个异常提示,我想每个人都能看懂:在studio.geek.entity.StudentInsurance这个实体类里没有属性insurance_id的getter方法。

出现这个There is no getter for property named 'xxx' in 'class xxx'的异常,一般在提示的类里加上对应属性的getter方法就可以了(如果真的是因为在提示的类里缺少getter方法的话)。

但是我的程序故障不在这里,而是在映射文件里。

事实上当我看到是insurance_id属性缺少getter方法的时候,我就知道,绝对不是这个类里缺少insurance_id的getter方法,因为我的这个类里根本没有这个属性。而且我知道,这个insurance_id是数据表的字段,它对应的实体类的属性是insuranceId,所以我猜测可能是映射文件写错了。

找到映射文件:

    <select id="selectByPrimaryKey" parameterType="studio.geek.entity.StudentInsuranceKey" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM student_insurance
        WHERE student_id = #{studentId,jdbcType=CHAR}
        AND insurance_id = #{insurance_id,jdbcType=SMALLINT}
    </select>


如上面粗体标注的部分,果然写错了,insuranceId写成了insurance_id。将错误改掉之后,异常解决。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

架构帅

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值