When publishing my project in eclipse, an error appears that my mapper already exists
Here is my error:
Nov 16, 2018 9:27:00 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ictinvMapper' defined in file [C:UsersRicardoworkspace3.metadata.pluginsorg.eclipse.wst.server.coretmp0wtpwebappsINTRANET4BWEB-INFclassesdohro4bintranet4bpersistenceIctinvMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for doh.ro4b.intranet4b.persistence.IctinvMapper.getIctinvList
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:753)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:834)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for doh.ro4b.intranet4b.persistence.IctinvMapper.getIctinvList
at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:84)
at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
... 21 more
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for doh.ro4b.intranet4b.persistence.IctinvMapper.getIctinvList
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:120)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.loadXmlResource(MapperAnnotationBuilder.java:167)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:118)
at org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:72)
at org.apache.ibatis.session.Configuration.addMapper(Configuration.java:671)
at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:81)
... 24 more
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for doh.ro4b.intranet4b.persistence.IctinvMapper.getIctinvList
at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:802)
at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:774)
at org.apache.ibatis.session.Configuration.addMappedStatement(Configuration.java:598)
at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:300)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:109)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:135)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:128)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:118)
... 30 more
this is my interface:
usually the id in the xml and in the interface are the same.
package doh.ro4b.intranet4b.persistence;
import java.util.List;
import doh.ro4b.intranet4b.domain.Ictinv;
public interface IctinvMapper
public List<Ictinv> getIctinvList (Ictinv ictinv);
public int getTotalRowCountIctinv ();
public void addIctinv (Ictinv ictinv);
public Ictinv viewIctinv (int ictinv_seqno);
public int modifyIctinv (Ictinv ictinv);
public int deleteIctinv (int ictinv_seqno);
this is my xml mapper:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="doh.ro4b.intranet4b.persistence.IctinvMapper">
<select id="getIctinvList" parameterType="Ictinv" resultType="Ictinv">
SELECT *
FROM tbl_ictinv
ORDER BY ictinv_seqno ASC
<!-- LIMIT #startRowNo, #rowCountPerPage -->
</select>
<select id="getTotalRowCountIctinv" parameterType="Ictinv"
resultType="int">
SELECT COUNT(ictinv_seqno)
FROM tbl_ictinv
</select>
if I remove the Insert and Update tagging, no error appears
notice that i dont use same id name
<insert id="addIctinv" parameterType="Ictinv">
INSERT INTO
tbl_ictinv
(ictinv_seqno,
eqdetail_seqno,
ictinv_macaddr,
ictinv_year,
ictinv_propno,
ictinv_unitval,
equom_seqno,
ictinv_qtypropcard,
ictinv_qtyphyscount,
ictinv_respname,
ictinv_assignname,
eqstat_seqno,
ictinv_acccode,
ictinv_audit,
ictinv_date)
VALUES (#ictinv_seqno,
#eqdetail_seqno,
#ictinv_macaddr,
#ictinv_year,
#ictinv_propno,
#ictinv_unitval,
#equom_seqno,
#ictinv_qtypropcard,
#ictinv_qtyphyscount,
#ictinv_respname,
#ictinv_assignname,
#eqstat_seqno,
#ictinv_acccode,
#ictinv_audit,
#ictinv_date)
</insert>
<select id="viewIctinv" parameterType="int" resultType="Ictinv">
SELECT *
FROM tbl_ictinv
WHERE ictinv_seqno = #ictinv_seqno
</select>
<update id="modifyIctinv" parameterType="Ictinv">
UPDATE
tbl_ictinv
SET
ictinv_seqno = #ictinv_seqno,
eqdetail_seqno = #eqdetail_seqno,
ictinv_macaddr = #ictinv_macaddr,
ictinv_year = #ictinv_year,
ictinv_propno = #ictinv_propno,
ictinv_unitval = #ictinv_unitval,
equom_seqno = #equom_seqno,
ictinv_qtypropcard = #ictinv_qtypropcard,
ictinv_qtyphyscount = #ictinv_qtyphyscount,
ictinv_respname = #ictinv_respname,
ictinv_assignname = #ictinv_assignname,
eqstat_seqno = #eqstat_seqno,
ictinv_acccode = #ictinv_acccode,
ictinv_audit = #ictinv_audit,
ictinv_date = #ictinv_date
WHERE ictinv_seqno = #ictinv_seqno
</update>
<delete id="deleteIctinv" parameterType="Ictinv">
DELETE
FROM tbl_ictinv
WHERE ictinv_seqno = #ictinv_seqno
</delete>
</mapper>
Note: if I remove the Insert and Update tagging, it doesn't have errors. What will be the best solution?
java spring-mybatis
add a comment |
Here is my error:
Nov 16, 2018 9:27:00 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ictinvMapper' defined in file [C:UsersRicardoworkspace3.metadata.pluginsorg.eclipse.wst.server.coretmp0wtpwebappsINTRANET4BWEB-INFclassesdohro4bintranet4bpersistenceIctinvMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for doh.ro4b.intranet4b.persistence.IctinvMapper.getIctinvList
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:753)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:834)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for doh.ro4b.intranet4b.persistence.IctinvMapper.getIctinvList
at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:84)
at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
... 21 more
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for doh.ro4b.intranet4b.persistence.IctinvMapper.getIctinvList
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:120)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.loadXmlResource(MapperAnnotationBuilder.java:167)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:118)
at org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:72)
at org.apache.ibatis.session.Configuration.addMapper(Configuration.java:671)
at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:81)
... 24 more
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for doh.ro4b.intranet4b.persistence.IctinvMapper.getIctinvList
at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:802)
at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:774)
at org.apache.ibatis.session.Configuration.addMappedStatement(Configuration.java:598)
at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:300)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:109)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:135)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:128)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:118)
... 30 more
this is my interface:
usually the id in the xml and in the interface are the same.
package doh.ro4b.intranet4b.persistence;
import java.util.List;
import doh.ro4b.intranet4b.domain.Ictinv;
public interface IctinvMapper
public List<Ictinv> getIctinvList (Ictinv ictinv);
public int getTotalRowCountIctinv ();
public void addIctinv (Ictinv ictinv);
public Ictinv viewIctinv (int ictinv_seqno);
public int modifyIctinv (Ictinv ictinv);
public int deleteIctinv (int ictinv_seqno);
this is my xml mapper:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="doh.ro4b.intranet4b.persistence.IctinvMapper">
<select id="getIctinvList" parameterType="Ictinv" resultType="Ictinv">
SELECT *
FROM tbl_ictinv
ORDER BY ictinv_seqno ASC
<!-- LIMIT #startRowNo, #rowCountPerPage -->
</select>
<select id="getTotalRowCountIctinv" parameterType="Ictinv"
resultType="int">
SELECT COUNT(ictinv_seqno)
FROM tbl_ictinv
</select>
if I remove the Insert and Update tagging, no error appears
notice that i dont use same id name
<insert id="addIctinv" parameterType="Ictinv">
INSERT INTO
tbl_ictinv
(ictinv_seqno,
eqdetail_seqno,
ictinv_macaddr,
ictinv_year,
ictinv_propno,
ictinv_unitval,
equom_seqno,
ictinv_qtypropcard,
ictinv_qtyphyscount,
ictinv_respname,
ictinv_assignname,
eqstat_seqno,
ictinv_acccode,
ictinv_audit,
ictinv_date)
VALUES (#ictinv_seqno,
#eqdetail_seqno,
#ictinv_macaddr,
#ictinv_year,
#ictinv_propno,
#ictinv_unitval,
#equom_seqno,
#ictinv_qtypropcard,
#ictinv_qtyphyscount,
#ictinv_respname,
#ictinv_assignname,
#eqstat_seqno,
#ictinv_acccode,
#ictinv_audit,
#ictinv_date)
</insert>
<select id="viewIctinv" parameterType="int" resultType="Ictinv">
SELECT *
FROM tbl_ictinv
WHERE ictinv_seqno = #ictinv_seqno
</select>
<update id="modifyIctinv" parameterType="Ictinv">
UPDATE
tbl_ictinv
SET
ictinv_seqno = #ictinv_seqno,
eqdetail_seqno = #eqdetail_seqno,
ictinv_macaddr = #ictinv_macaddr,
ictinv_year = #ictinv_year,
ictinv_propno = #ictinv_propno,
ictinv_unitval = #ictinv_unitval,
equom_seqno = #equom_seqno,
ictinv_qtypropcard = #ictinv_qtypropcard,
ictinv_qtyphyscount = #ictinv_qtyphyscount,
ictinv_respname = #ictinv_respname,
ictinv_assignname = #ictinv_assignname,
eqstat_seqno = #eqstat_seqno,
ictinv_acccode = #ictinv_acccode,
ictinv_audit = #ictinv_audit,
ictinv_date = #ictinv_date
WHERE ictinv_seqno = #ictinv_seqno
</update>
<delete id="deleteIctinv" parameterType="Ictinv">
DELETE
FROM tbl_ictinv
WHERE ictinv_seqno = #ictinv_seqno
</delete>
</mapper>
Note: if I remove the Insert and Update tagging, it doesn't have errors. What will be the best solution?
java spring-mybatis
add a comment |
Here is my error:
Nov 16, 2018 9:27:00 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ictinvMapper' defined in file [C:UsersRicardoworkspace3.metadata.pluginsorg.eclipse.wst.server.coretmp0wtpwebappsINTRANET4BWEB-INFclassesdohro4bintranet4bpersistenceIctinvMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for doh.ro4b.intranet4b.persistence.IctinvMapper.getIctinvList
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:753)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:834)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for doh.ro4b.intranet4b.persistence.IctinvMapper.getIctinvList
at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:84)
at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
... 21 more
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for doh.ro4b.intranet4b.persistence.IctinvMapper.getIctinvList
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:120)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.loadXmlResource(MapperAnnotationBuilder.java:167)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:118)
at org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:72)
at org.apache.ibatis.session.Configuration.addMapper(Configuration.java:671)
at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:81)
... 24 more
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for doh.ro4b.intranet4b.persistence.IctinvMapper.getIctinvList
at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:802)
at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:774)
at org.apache.ibatis.session.Configuration.addMappedStatement(Configuration.java:598)
at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:300)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:109)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:135)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:128)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:118)
... 30 more
this is my interface:
usually the id in the xml and in the interface are the same.
package doh.ro4b.intranet4b.persistence;
import java.util.List;
import doh.ro4b.intranet4b.domain.Ictinv;
public interface IctinvMapper
public List<Ictinv> getIctinvList (Ictinv ictinv);
public int getTotalRowCountIctinv ();
public void addIctinv (Ictinv ictinv);
public Ictinv viewIctinv (int ictinv_seqno);
public int modifyIctinv (Ictinv ictinv);
public int deleteIctinv (int ictinv_seqno);
this is my xml mapper:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="doh.ro4b.intranet4b.persistence.IctinvMapper">
<select id="getIctinvList" parameterType="Ictinv" resultType="Ictinv">
SELECT *
FROM tbl_ictinv
ORDER BY ictinv_seqno ASC
<!-- LIMIT #startRowNo, #rowCountPerPage -->
</select>
<select id="getTotalRowCountIctinv" parameterType="Ictinv"
resultType="int">
SELECT COUNT(ictinv_seqno)
FROM tbl_ictinv
</select>
if I remove the Insert and Update tagging, no error appears
notice that i dont use same id name
<insert id="addIctinv" parameterType="Ictinv">
INSERT INTO
tbl_ictinv
(ictinv_seqno,
eqdetail_seqno,
ictinv_macaddr,
ictinv_year,
ictinv_propno,
ictinv_unitval,
equom_seqno,
ictinv_qtypropcard,
ictinv_qtyphyscount,
ictinv_respname,
ictinv_assignname,
eqstat_seqno,
ictinv_acccode,
ictinv_audit,
ictinv_date)
VALUES (#ictinv_seqno,
#eqdetail_seqno,
#ictinv_macaddr,
#ictinv_year,
#ictinv_propno,
#ictinv_unitval,
#equom_seqno,
#ictinv_qtypropcard,
#ictinv_qtyphyscount,
#ictinv_respname,
#ictinv_assignname,
#eqstat_seqno,
#ictinv_acccode,
#ictinv_audit,
#ictinv_date)
</insert>
<select id="viewIctinv" parameterType="int" resultType="Ictinv">
SELECT *
FROM tbl_ictinv
WHERE ictinv_seqno = #ictinv_seqno
</select>
<update id="modifyIctinv" parameterType="Ictinv">
UPDATE
tbl_ictinv
SET
ictinv_seqno = #ictinv_seqno,
eqdetail_seqno = #eqdetail_seqno,
ictinv_macaddr = #ictinv_macaddr,
ictinv_year = #ictinv_year,
ictinv_propno = #ictinv_propno,
ictinv_unitval = #ictinv_unitval,
equom_seqno = #equom_seqno,
ictinv_qtypropcard = #ictinv_qtypropcard,
ictinv_qtyphyscount = #ictinv_qtyphyscount,
ictinv_respname = #ictinv_respname,
ictinv_assignname = #ictinv_assignname,
eqstat_seqno = #eqstat_seqno,
ictinv_acccode = #ictinv_acccode,
ictinv_audit = #ictinv_audit,
ictinv_date = #ictinv_date
WHERE ictinv_seqno = #ictinv_seqno
</update>
<delete id="deleteIctinv" parameterType="Ictinv">
DELETE
FROM tbl_ictinv
WHERE ictinv_seqno = #ictinv_seqno
</delete>
</mapper>
Note: if I remove the Insert and Update tagging, it doesn't have errors. What will be the best solution?
java spring-mybatis
Here is my error:
Nov 16, 2018 9:27:00 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ictinvMapper' defined in file [C:UsersRicardoworkspace3.metadata.pluginsorg.eclipse.wst.server.coretmp0wtpwebappsINTRANET4BWEB-INFclassesdohro4bintranet4bpersistenceIctinvMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for doh.ro4b.intranet4b.persistence.IctinvMapper.getIctinvList
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:753)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:834)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for doh.ro4b.intranet4b.persistence.IctinvMapper.getIctinvList
at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:84)
at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
... 21 more
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for doh.ro4b.intranet4b.persistence.IctinvMapper.getIctinvList
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:120)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.loadXmlResource(MapperAnnotationBuilder.java:167)
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:118)
at org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:72)
at org.apache.ibatis.session.Configuration.addMapper(Configuration.java:671)
at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:81)
... 24 more
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for doh.ro4b.intranet4b.persistence.IctinvMapper.getIctinvList
at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:802)
at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:774)
at org.apache.ibatis.session.Configuration.addMappedStatement(Configuration.java:598)
at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:300)
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:109)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:135)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:128)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:118)
... 30 more
this is my interface:
usually the id in the xml and in the interface are the same.
package doh.ro4b.intranet4b.persistence;
import java.util.List;
import doh.ro4b.intranet4b.domain.Ictinv;
public interface IctinvMapper
public List<Ictinv> getIctinvList (Ictinv ictinv);
public int getTotalRowCountIctinv ();
public void addIctinv (Ictinv ictinv);
public Ictinv viewIctinv (int ictinv_seqno);
public int modifyIctinv (Ictinv ictinv);
public int deleteIctinv (int ictinv_seqno);
this is my xml mapper:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="doh.ro4b.intranet4b.persistence.IctinvMapper">
<select id="getIctinvList" parameterType="Ictinv" resultType="Ictinv">
SELECT *
FROM tbl_ictinv
ORDER BY ictinv_seqno ASC
<!-- LIMIT #startRowNo, #rowCountPerPage -->
</select>
<select id="getTotalRowCountIctinv" parameterType="Ictinv"
resultType="int">
SELECT COUNT(ictinv_seqno)
FROM tbl_ictinv
</select>
if I remove the Insert and Update tagging, no error appears
notice that i dont use same id name
<insert id="addIctinv" parameterType="Ictinv">
INSERT INTO
tbl_ictinv
(ictinv_seqno,
eqdetail_seqno,
ictinv_macaddr,
ictinv_year,
ictinv_propno,
ictinv_unitval,
equom_seqno,
ictinv_qtypropcard,
ictinv_qtyphyscount,
ictinv_respname,
ictinv_assignname,
eqstat_seqno,
ictinv_acccode,
ictinv_audit,
ictinv_date)
VALUES (#ictinv_seqno,
#eqdetail_seqno,
#ictinv_macaddr,
#ictinv_year,
#ictinv_propno,
#ictinv_unitval,
#equom_seqno,
#ictinv_qtypropcard,
#ictinv_qtyphyscount,
#ictinv_respname,
#ictinv_assignname,
#eqstat_seqno,
#ictinv_acccode,
#ictinv_audit,
#ictinv_date)
</insert>
<select id="viewIctinv" parameterType="int" resultType="Ictinv">
SELECT *
FROM tbl_ictinv
WHERE ictinv_seqno = #ictinv_seqno
</select>
<update id="modifyIctinv" parameterType="Ictinv">
UPDATE
tbl_ictinv
SET
ictinv_seqno = #ictinv_seqno,
eqdetail_seqno = #eqdetail_seqno,
ictinv_macaddr = #ictinv_macaddr,
ictinv_year = #ictinv_year,
ictinv_propno = #ictinv_propno,
ictinv_unitval = #ictinv_unitval,
equom_seqno = #equom_seqno,
ictinv_qtypropcard = #ictinv_qtypropcard,
ictinv_qtyphyscount = #ictinv_qtyphyscount,
ictinv_respname = #ictinv_respname,
ictinv_assignname = #ictinv_assignname,
eqstat_seqno = #eqstat_seqno,
ictinv_acccode = #ictinv_acccode,
ictinv_audit = #ictinv_audit,
ictinv_date = #ictinv_date
WHERE ictinv_seqno = #ictinv_seqno
</update>
<delete id="deleteIctinv" parameterType="Ictinv">
DELETE
FROM tbl_ictinv
WHERE ictinv_seqno = #ictinv_seqno
</delete>
</mapper>
Note: if I remove the Insert and Update tagging, it doesn't have errors. What will be the best solution?
java spring-mybatis
java spring-mybatis
asked Nov 16 '18 at 2:02
Dinky MalubagDinky Malubag
12
12
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53330429%2fwhen-publishing-my-project-in-eclipse-an-error-appears-that-my-mapper-already-e%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53330429%2fwhen-publishing-my-project-in-eclipse-an-error-appears-that-my-mapper-already-e%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown