Mybatis Ambiguous collection type for property ‘xxx‘. You must specify ‘java Type‘ or ‘resultMap‘.
程序员文章站
2022-06-17 19:11:28
使用resultMap映射VO对象时:public class CategoryVO { private Integer id; private String name; private String type; private Integer fatherId; // 三级分类vo list private List subCatList;// getter & setter}
使用resultMap映射VO对象时:
public class CategoryVO {
private Integer id;
private String name;
private String type;
private Integer fatherId;
// 三级分类vo list
private List<SubCategoryVO> subCatList;
// getter & setter
}
<resultMap id="myCategoryVO" type="com.imooc.pojo.vo.CategoryVO">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="type" property="type"/>
<result column="fatherId" property="fatherId"/>
<!--
collection 标签:用于定义关联的list集合类型的封装规则
property:对应三级分类的list属性名
ofType:集合的类型,三级分类的vo
-->
<collection property="subCatList" ofType="com.imooc.pojo.vo.SubCategoryVO">
<id column="subId" property="subId"/>
<result column="subName" property="subName"/>
<result column="subType" property="subType"/>
<result column="subFatherId" property="subFatherId"/>
</collection>
</resultMap>
collection 的property属性要和VO中的 List类型的属性名称一致,否则会报题目所示错误。
本文地址:https://blog.csdn.net/qq_43581949/article/details/109616975
推荐阅读
-
Ambiguous collection type for property ‘ ‘. You must specify ‘javaType‘ or ‘resultMap‘解决方案
-
记录一次:Ambiguous collection type for property ‘ adds‘. You must specify ‘javaType‘ or ‘resultMap‘.错误;
-
Ambiguous collection type for property ‘DrugInfos‘. You must specify ‘javaType‘ or ‘resultMap‘.
-
Mybatis Ambiguous collection type for property ‘xxx‘. You must specify ‘java Type‘ or ‘resultMap‘.
-
Mybatis Ambiguous collection type for property ‘xxx‘. You must specify ‘java Type‘ or ‘resultMap‘.
-
Mybatis Ambiguous collection type for property ‘xxx‘. You must specify ‘java Type‘ or ‘resultMap‘.