ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aravind.s <aravin...@cgi.com>
Subject Error while trying to call stored proc from ibatis
Date Thu, 18 Jun 2009 13:43:17 GMT
Hi,

 

Am trying to call a stored procedure from ibatis.

 

 

SqlMap.xml

 

<parameterMap id="parameterId" class="Sample">

            <parameter property="id" jdbcType="VARCHAR"
javaType="java.lang.String" mode="IN" />

            <parameter property="name" jdbcType="VARCHAR"
javaType="java.lang.String" mode="IN" />

            <parameter property="result" jdbcType="VARCHAR"
javaType="java.lang.String" mode="OUT" />

</parameterMap>

 

 

      <procedure id="sampleProc" parameterMap="parameterId">

      {call sample_stored_proc(?,?,?)}</procedure>

 

Java Class

 

Sample sample = new Sample();

            sample.setId( "111" );

            sample.setName ( "name1" );

            sample.setResult("" );

            (String)getSqlMapClientTemplate().queryForObject(
"sampleProc", sample );

 

Am getting the below exception.

Any idea where am going wrong?

 

 

org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation;
bad SQL grammar []; nested exception is
com.ibatis.common.jdbc.exception.NestedSQLException:   

--- The error occurred in SqlMap.xml.  

--- The error occurred while applying a parameter map.  

--- Check the parameterId.  

--- Check the statement (update procedure failed).  

--- Cause: java.sql.SQLException: The number of parameter values set or
registered does not match the number of parameters.

            at
org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTransl
ate(SQLStateSQLExceptionTranslator.java:97)

            at
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.
translate(AbstractFallbackSQLExceptionTranslator.java:72)

            at
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.
translate(AbstractFallbackSQLExceptionTranslator.java:80)

            at
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.
translate(AbstractFallbackSQLExceptionTranslator.java:80)

            at
org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClient
Template.java:212)

            at
org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMa
pClientTemplate.java:271)

            

 

 

Thanks In Advance,

Aravind. S 

 


Mime
View raw message