ibatis出现Mapped Statements collection already contains value for com.chong.model.AccountMapper.checkAccount错误

  1. Mapped Statements collection already contains value for com.chong.model.AccountMapper.checkAccount
  2. Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for com.chong.model.AccountMapper.checkAccount
  3. Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for com.chong.model.AccountMapper.checkAccount
  4. ### Error building SqlSession. ### The error may exist in com/chong/model/AccountMapper.xml ### The error occurred while processing mapper_resultMap[cc_account] ### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for com.chong.model.AccountMapper.checkAccount
  5. allAccounts
  6. Caught an exception while getting the property values of com.chong.action.AccountAction@451268
  7. Caught an exception while getting the property values of com.chong.action.AccountAction@451268 - Class: ognl.OgnlRuntime File: OgnlRuntime.java Method: getMethodValue Line: 1456 - ognl/OgnlRuntime.java:1456:-1re

错误原因是由于使用ibatis的AccountMapper.xml实现接口AccountMapper.java中的方法的时候的id有重复的值,比如

 <select id="checkAccount"  parameterType="com.chong.model.Account" resultType="int">中的checkAccount在一个xml文件中有两个这样的id,修改过来即可

原文地址:https://www.cnblogs.com/langtianya/p/2966491.html