Ambiguous collection type for property 'categories'. You must specify 'javaType' or 'resultMap'.解决方法

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

 
 
 
posted @   临易  阅读(601)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· PowerShell开发游戏 · 打蜜蜂
· 在鹅厂做java开发是什么体验
· 百万级群聊的设计实践
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
· 永远不要相信用户的输入:从 SQL 注入攻防看输入验证的重要性
点击右上角即可分享
微信分享提示