Ambiguous collection type for property 'categories'. You must specify 'javaType'
作者:互联网
1.具体报错信息:
Caused by: org.apache.ibatis.builder.BuilderException: Ambiguous collection type for property 'categories'. You must specify 'javaType' or 'resultMap'. at org.apache.ibatis.builder.xml.XMLMapperBuilder.validateCollection(XMLMapperBuilder.java:412) at org.apache.ibatis.builder.xml.XMLMapperBuilder.processNestedResultMappings(XMLMapperBuilder.java:399) at org.apache.ibatis.builder.xml.XMLMapperBuilder.lambda$buildResultMappingFromContext$0(XMLMapperBuilder.java:383) at org.apache.ibatis.parsing.XNode.getStringAttribute(XNode.java:200) at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildResultMappingFromContext(XMLMapperBuilder.java:382) at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:280) at org.apache.ibatis.builder.xml.XMLMapperBuilder.processNestedResultMappings(XMLMapperBuilder.java:400) at org.apache.ibatis.builder.xml.XMLMapperBuilder.lambda$buildResultMappingFromContext$0(XMLMapperBuilder.java:383) at org.apache.ibatis.parsing.XNode.getStringAttribute(XNode.java:200) at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildResultMappingFromContext(XMLMapperBuilder.java:382) at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:280) at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:254) at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:246) at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:119) ... 95 more
2.原因
MyBatis升级之后,语法要求有所变化,原来是可以不写 javaType属性的。
3.解决方法:
在collection中添加javaType属性,属性值为collection的内部数据类型。
<collection property="categories" ofType="com.qfedu.fmmall.entity.CategoryVO" javaType="list">
4.参考资料:
https://blog.csdn.net/qq_29384789/article/details/124963014
标签:Ambiguous,java,builder,collection,ibatis,XMLMapperBuilder,resultMap,apache,org 来源: https://www.cnblogs.com/lysboke/p/16490422.html