Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.zwan.dao.TbAdminMapper.BaseResultMap
Error creating bean with name ‘SqlSessionFactoryBean’ defined in file [D:\tomcat\apache-tomcat-7.0.91\wtpwebapps\ssm-maven\WEB-INF\classes\spring\applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [D:\tomcat\apache-tomcat-7.0.91\wtpwebapps\ssm-maven\WEB-INF\classes\com\zwan\mapper\TbAdminMapper.xml]’; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is ‘file [D:\tomcat\apache-tomcat-7.0.91\wtpwebapps\ssm-maven\WEB-INF\classes\com\zwan\mapper\TbAdminMapper.xml]’. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.zwan.dao.TbAdminMapper.BaseResultMap
问题:
- TbAdminMapper.xml中 <resultMap id=“BaseResultMap” id出现重复
- 缺少主键方法
http://www.mamicode.com/info-detail-2550510.html
检查发现TbAdminMapper.xml中 <resultMap id=“BaseResultMap” id出现重复,原来是xml文件出现双份内容;而且缺少主键方法
mybatis 逆向工程 自动生成的mapper文件没有 主键方法(附解决方法)
解决方法:
无法生成带主键的方法主要是因为mysql-connector-java 驱动版本问题
我的mysql-connector-java 驱动版本用的是8.x的
换成mysql5.x版本后,逆向工程可以生成带主键的方法了,其他问题也随之解决