当前位置:   article > 正文

Mapper XML 中报错:Caused by: java.lang.ClassNotFoundException: Cannot find class : XXX 解决方案_java mapper cannot not find class

java mapper cannot not find class

xml:

  1. <resultMap id="spuItemAttrGroupVo" type="com.atguigu.gulimall.product.vo.SpuItemAttrGroupVo">
  2. <result property="groupName" column="attr_group_name"></result>
  3. <collection property="attrs" ofType="com.atguigu.gulimall.product.vo.SpuBaseAttrVo">
  4. <result column="attr_name" property="attrName"></result>
  5. <result column="attr_value" property="attrValues"></result>
  6. </collection>
  7. </resultMap>
  8. <select id="getAttrGroupWithAttrsBySpuId"
  9. resultType="spuItemAttrGroupVo">
  10. SELECT attr_name ,attr_value ,pag.attr_group_name
  11. FROM pms_product_attr_value ppav
  12. LEFT JOIN pms_attr_attrgroup_relation paar ON paar.attr_id = ppav.attr_id
  13. LEFT JOIN pms_attr_group pag ON pag.attr_group_id= paar.attr_group_id and pag.catelog_id= #{catalogId}
  14. WHERE ppav.spu_id = #{spuId};
  15. </select>

后面发现 把 resultMap 写成了 resultType ,修改后:程序运行成功

  1. <resultMap id="spuItemAttrGroupVo" type="com.atguigu.gulimall.product.vo.SpuItemAttrGroupVo">
  2. <result property="groupName" column="attr_group_name"></result>
  3. <collection property="attrs" ofType="com.atguigu.gulimall.product.vo.SpuBaseAttrVo">
  4. <result column="attr_name" property="attrName"></result>
  5. <result column="attr_value" property="attrValues"></result>
  6. </collection>
  7. </resultMap>
  8. <select id="getAttrGroupWithAttrsBySpuId"
  9. resultMap="spuItemAttrGroupVo">
  10. SELECT attr_name ,attr_value ,pag.attr_group_name
  11. FROM pms_product_attr_value ppav
  12. LEFT JOIN pms_attr_attrgroup_relation paar ON paar.attr_id = ppav.attr_id
  13. LEFT JOIN pms_attr_group pag ON pag.attr_group_id= paar.attr_group_id and pag.catelog_id= #{catalogId}
  14. WHERE ppav.spu_id = #{spuId};
  15. </select>

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/618468
推荐阅读
相关标签
  

闽ICP备14008679号