You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by on 2010/01/07 16:30:59 UTC

Calling a SP throws TypeException

Hello,

while trying to call a Stored Procedure I received the following execption. The documentation doesn't cover much about how to handle Stored Procedures so I thought I am better of asking this here.

My setp up is iBatis 3.0 Beta 7 and a SQL Server 2008.

In tsql I call my sp like this:
DECLARE @valid AS BIT
EXECUTE usp_LoginUser 'some_user', 'pass', @valid OUT
SELECT @valid

In my UserMapping.xml I declared:
<update id="validate" parameterType="hashmap" statementType="CALLABLE">

EXECUTE usp_LoginUser #{username,jdbcType=VARCHAR, javaType=String, mode=IN}, #{password, jdbcType=VARCHAR, javaType=String, mode=IN}, #{valid, jdbcType=BIT, javaType=Boolean, mode=OUT}
</update>

and finally the calling code looks like this:

UserMapper mapper = session.getMapper(UserMapper.class);
Boolean valid = Boolean.FALSE;
Map m = new HashMap();
m.put("username", username);
m.put("password", password);
m.put("valid", valid);
mapper.validate(m);

My unit test fails with the following error:

org.apache.ibatis.exceptions.IbatisException: 
### Error updating database.  Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'IN'.  Cause: java.lang.ClassNotFoundException: Cannot find class: IN
### The error may exist in de/e2n/stadtlichter/db/data/UserMapper.xml
### The error may involve de.e2n.stadtlichter.db.data.UserMapper.validate
### The error occurred while executing an update
### Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'IN'.  Cause: java.lang.ClassNotFoundException: Cannot find class: IN
 at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
 at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:95)
 at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:55)
 at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:18)

Any help would be appreciated. Thanks in advance.

Btw, there is a typo in the documentation.
p21. delete - A mapped DELEETE statement
...