org.apache.ibatis.reflection.ReflectionException:There is no getter for property named 'parentId' in

来源:互联网 发布:网络交换机图片 编辑:程序博客网 时间:2024/05/16 15:28
  • 异常信息:
    • org.apache.ibatis.reflection.ReflectionException:There is no getter for property named 'parentId' in 'class java.lang.Long'
  • 动态sql:
<selectid="selectByParentId" parameterType="java.lang.Long" resultMap="BaseResultMap">
     select
     <include refid="column" />
     from tb_item_cat
     <where>
           <if test="parentId != null">
                parent_id=#{parentId}
           </if>
     </where>
</select>
  • 原因:
    • 原因出在test="parentId != null"
  • 修改方法:
    • 将参数parentId修改为_paramter
<select id="selectByParentId" parameterType="java.lang.Long" resultMap="BaseResultMap">
     select
     <include refid="column" />
     from tb_item_cat
     <where>
           <if test="_parameter != null">
                parent_id=#{_parameter}
           </if>
     </where>
</select>

0 0
原创粉丝点击