try using the full name including the namespace, or rename one of the entries解决方法

怼烎@ 2023-09-29 10:08 20阅读 0赞

异常如下

  1. org.apache.ibatis.exceptions.PersistenceException:
  2. ### Error querying database. Cause: java.lang.IllegalArgumentException:
  3. NoticeMap is ambiguous in Result Maps collection (try using the full name including the namespace,
  4. or rename one of the entries)
  5. ### Cause: java.lang.IllegalArgumentException:
  6. NoticeMap is ambiguous in Result Maps collection (try using the full name including the namespace,
  7. or rename one of the entries)

原因:mybatis 的 mapper 文件中定义了 相同id 的 resultMap,也可能是不同的mapper文件,比如

A.xml

  1. <mapper namespace="...Dao">
  2. <resultMap id="NoticeMap" type="java.util.Map"/>

B.xml

  1. <mapper namespace="...Dao">
  2. <resultMap id="NoticeMap" type="java.util.Map"/>

id 都是 NoticeMap,所以会报这个错。

发表评论

表情:
评论列表 (有 0 条评论,20人围观)

还没有评论,来说两句吧...

相关阅读