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>

 

posted @ 2018-09-08 10:23  测试5454  阅读(987)  评论(0编辑  收藏  举报