ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Maves <nathan.ma...@gmail.com>
Subject [IB3] method overloading in a mapper
Date Wed, 17 Mar 2010 18:07:27 GMT
I think I just ran into a small issue.  I have the follow in my mapper
interface.  The second method has the sql defined in a XML file.


@Select("select Clients.* from Clients, Accounts where Accounts.id =
Clients.accountId and Accounts.id = #{accountId} order by name")

public List<Client> listForAccount(Integer accountId);


public List<Client> listForAccount(@Param("accountId") Integer accountId,
@Param("userId") Integer userId);



I am getting this :


### Error building SqlSession.

### The error may exist in com/abc/persistence/ClientsMapper.java (best
guess)

### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL
Mapper Configuration. Cause: java.lang.IllegalArgumentException: Mapped
Statements collection already contains value for
com.abc.persistence.ClientsMapper.listForAccount

at
org.apache.ibatis.exceptions.ExceptionFactory.wrapException(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.abc.persistence.IbatisConfig.get(IbatisConfig.java:28)

at
com.abc.persistence.GlobalSqlSessionManager.<clinit>(GlobalSqlSessionManager.java:9)

... 39 more

Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL
Mapper Configuration. Cause: java.lang.IllegalArgumentException: Mapped
Statements collection already contains value for
com.abc.persistence.ClientsMapper.listForAccount

at
org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:68)

at
org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:53)

at
org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:28)

... 42 more

Caused by: java.lang.IllegalArgumentException: Mapped Statements collection
already contains value for com.abc.persistence.ClientsMapper.listForAccount

at
org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:360)

at
org.apache.ibatis.session.Configuration.addMappedStatement(Configuration.java:300)

at
org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:215)

at
org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parseStatement(MapperAnnotationBuilder.java:194)

at
org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:56)

at
org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:43)

at org.apache.ibatis.session.Configuration.addMapper(Configuration.java:320)

at
org.apache.ibatis.builder.xml.XMLMapperBuilder.bindMapperForNamespace(XMLMapperBuilder.java:234)

at
org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:40)

at
org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:226)

at
org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:66)

Mime
View raw message