mybatis异常:There is no getter for property named 'xxx' in 'xxx'

在使用mybatis查询的时候出现了下面的异常:

org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'dictType' in 'class com.up.sell.vo.system.Advertisement'
    at org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:419) ~[mybatis-3.4.6.jar:3.4.6]
    at org.apache.ibatis.reflection.MetaClass.getGetInvoker(MetaClass.java:164) ~[mybatis-3.4.6.jar:3.4.6]
    at org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:162) ~[mybatis-3.4.6.jar:3.4.6]
    at org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:49) ~[mybatis-3.4.6.jar:3.4.6]
    at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:122) ~[mybatis-3.4.6.jar:3.4.6]

这个错误的原因是我的resultMap大小写写错了,大家做好看一下实体中的字段和mapper中的大小写,别搞反。

贴上代码,可以参照一下:

    <resultMap type="Advertisement" id="AdvertisementResult">
        <id property="id" column="id" />
        <result property="title" column="title" />
        <result property="imgPath" column="img_path" />
        <result property="url" column="url" />
        <result property="description" column="description" />
        <result property="sort" column="sort" />
        <result property="place" column="place" />
        <result property="provinceId" column="province_id" />
        <result property="cityId" column="city_id" />
        <result property="advFlag" column="adv_flag" />
        <result property="createUser" column="create_user" />
        <result property="createTime" column="create_time" />
        <result property="updateUser" column="update_user" />
        <result property="updateTime" column="update_time" />
        <association property="areas" column="id" javaType="com.up.sell.vo.system.Areas" resultMap="areasResult" />
        <association property="dictionary" column="id" javaType="com.up.sell.vo.system.Dictionary" resultMap="deptResult" />
    </resultMap>

    <resultMap id="areasResult" type="Areas">
        <id property="id" column="id" />
        <result property="areaName" column="area_name" />
        <result property="parentId" column="parent_id" />
        <result property="shortName" column="short_name" />
    </resultMap>

    <resultMap id="deptResult" type="Dictionary">
        <id property="dKey" column="d_key" />
        <result property="dValue" column="d_value" />
        <result property="dName" column="d_name" />
        <result property="parentKey" column="parent_ey" />
        <result property="flag" column="flag" />
    </resultMap>

 

转载于:https://www.cnblogs.com/itiande/p/9608100.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值