错误:org.apache.ibatis.builder.BuilderException: Ambiguous collection type for property ‘children‘.
Posted 白发随你去
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了错误:org.apache.ibatis.builder.BuilderException: Ambiguous collection type for property ‘children‘.相关的知识,希望对你有一定的参考价值。
写了一个多表查询功能后,项目报错:
Caused by: org.apache.ibatis.builder.BuilderException: Ambiguous collection type for property 'children'. You must specify 'javaType' or 'resultMap'.
at org.apache.ibatis.builder.xml.XMLMapperBuilder.validateCollection(XMLMapperBuilder.java:415)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.processNestedResultMappings(XMLMapperBuilder.java:401)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildResultMappingFromContext(XMLMapperBuilder.java:383)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:280)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:253)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:245)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:118)
... 77 common frames omitted
注意:Mapper.xml文件中 resultMap的Type类型和方法的返回值是否相同。
Mapper接口:
List<SubjectVo> selectNestedList();
错误写法:
<resultMap id="selectNestedListMap" type="com.jie.car.service.edu.entity.Subject">
修改为:
<resultMap id="selectNestedListMap" type="com.jie.car.service.edu.entity.Vo.SubjectVo">
以上是关于错误:org.apache.ibatis.builder.BuilderException: Ambiguous collection type for property ‘children‘.的主要内容,如果未能解决你的问题,请参考以下文章