ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: iBatis 3.x.x - documentation error ?
Date Fri, 14 Aug 2009 16:33:49 GMT
Can one of you file a Jira ticket with a description and a failing
unit test attached if possible?

Thanks much!

2009/8/14 Erdem Budak <erdembudak@hotmail.com>:
> Works fine now. Thank you.
>
> ________________________________
> From: Christian.Poitras@ircm.qc.ca
> To: user-java@ibatis.apache.org
> Date: Fri, 14 Aug 2009 09:11:03 -0400
> Subject: RE: iBatis 3.x.x - documentation error ?
>
> When I tried iBATIS 3, I've done like you naming my interface and my xml
> with the same name. Don't do that, iBATIS will throw an exception like
> yours.
>
> You should name your interface UserMapper.java and your xml User.xml. Make
> sure your namespace in User.xml points to your UserMapper interface.
> I beleive this is a bug.
>
> Christian
> ________________________________
> From: Erdem Budak [mailto:erdembudak@hotmail.com]
> Sent: Friday, August 14, 2009 6:01 AM
> To: user-java@ibatis.apache.org
> Subject: RE: iBatis 3.x.x - documentation error ?
>
> And what do think about the mapping class. Is something wrong with my code ?
>
> ________________________________
> Date: Thu, 13 Aug 2009 21:34:47 -0600
> Subject: Re: iBatis 3.x.x - documentation error ?
> From: clinton.begin@gmail.com
> To: user-java@ibatis.apache.org
>
> corrected.
>
> On Thu, Aug 13, 2009 at 9:22 AM, Clinton Begin <clinton.begin@gmail.com>
> wrote:
>
> Yep, that's a typo.  Should be parameterType and resultType....
>
> Clinton
>
> 2009/8/13 Erdem Budak <erdembudak@hotmail.com>
>
> Hello
>
> I trying to write a simple swing gui application using ibatis 3.x.x. I have
> a few problems doing it with the current documentation. I'll try to explain
> my problems.
>
> 1) The example code for mapper :
>
> <select id=”selectPerson” parameterClass=”int” resultClass=”hashmap”>
> SELECT * FROM PERSON WHERE ID = #{id}
> </select>
>
> Well i can't seem to use parameterClass or resultClass. They are not defined
> in dtd nor in documentation. I don't know if using parameterType and
> resultType gives the same result.
>
> 2) mapping classes from xml :
>
> I dont think it is enough documented. I tried to write a mapper class and
> could not manage to do it. What i tried to do is.
>
> -a UserMapper interface which defines a selectUser function.
>
> public interface UserMapper {
>
>     public User selectUser(int id);
>
> }
>
> -a UserMapper.xml
>
> <mapper namespace="com.erdm.ibatistest.UserMappe r">
>     <select id="selectUser" parameterType="int" resultType="hashmap">
>         SELECT * FROM users WHERE id = #{id}
>     </select>
> </mapper>
>
> -in my configuration.xml
>
> <mappers>
>     <mapper resource="com/erdm/ibatistest/UserMapper.xml" />
> </mappers>
>
> having the error
>
> Exception in thread "AWT-EventQueue-0"
> org.apache.ibatis.exceptions.IbatisException:
> ### Error building SqlSession.
> ### The error may exist in com/erdm/ibatistest/UserMapper.xml
> ### 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.erdm.ibatistest.UserMapper.selectUser
>     at org.apache.ibatis.exceptions.ExceptionFactory.wrap
> Exception(ExceptionFactory.java:8)
>     at
> org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:31)
>     at
> org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:14)
>     at com.erdm.ibatistest.MainJFrame.<init>(MainJFrame.java:164)
>     at com.erdm.ibatistest.MainJFrame$1.run(MainJFrame.java:70)
>     at java.awt.event.InvocationEvent.dispatch(Unknown Source)
>     at java.awt.EventQueue.dispatchEvent(Unknown Source)
>     at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
>     at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
>     at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
>     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>     at java.awt.Eve ntDispatchThread.pumpEvents(Unknown Source)
>     at java.awt.EventDispatchThread.run(Unknown Source)
> Caused by: 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.erdm.ibatistest.UserMapper.selectUser
>     at
> org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:62)
>     at
> org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:47)
>     at
> org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:28)
>     ... 11 more
> Caused by: java.lang.RuntimeException: Error parsing Mapper XML. Cause:
> java.lang.IllegalArgumentException: Mapped Statements collection already
> contains value for com.erdm.ibatistest.UserMapper.se lectUser
>     at
> org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:50)
>     at
> org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:31)
>     at
> org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.loadXmlResource(MapperAnnotationBuilder.java:50)
>     at
> org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:29)
>     at
> org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:42)
>     at
> org.apache.ibatis.mapping.Configuration.addMapper(Configuration.java:309)
>     at
> org.apache.ibatis.builder.xml.XMLMapperBuilder.bindMapperForNamespace(XMLMapperBuilder.java:227)
>     at
> org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:32)
>     at org.apache.ibatis.builder.xml.XMLConfigBuilder.
> mapperElement(XMLConfigBuilder.java:221)
>     at
> org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:60)
>     ... 13 more
> Caused by: java.lang.IllegalArgumentException: Mapped Statements collection
> already contains value for com.erdm.ibatistest.UserMapper.selectUser
>     at
> org.apache.ibatis.mapping.Configuration$StrictMap.put(Configuration.java:349)
>     at
> org.apache.ibatis.mapping.Configuration.addMappedStatement(Configuration.java:289)
>     at
> org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:213)
>     at
> org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:59)
>     at
> org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:185)
>     at org.apache.ibatis.builder.xml.XMLMapper
> Builder.configurationElement(XMLMapperBuilder.java:48)
>     ... 22 more
>
> Can't seem to get the mapper class work (old fashion way is fine). I would
> be glad if you could help me further. Thanks in advance.
>
>
> ________________________________
> check out the rest of the Windows Live™. More than mail–Windows Live™ goes
> way beyond your inbox. More than messages
>
>
> ________________________________
> Share your memories online with anyone you want anyone you want.
> ________________________________
> See all the ways you can stay connected to friends and family

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message