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: The error occurred while applying a parameter map.
Date Wed, 20 Jan 2010 13:36:14 GMT
If you use a parameterMap in iBATIS 2, you have to use question mark (JDBC
style) parameters, not named parameters.

{call UPSERT_PM_PRECEDENCE(?,?,?,?,?)}

Clinton

On Wed, Jan 20, 2010 at 6:30 AM, nani2ratna <nani2ratna@gmail.com> wrote:

>
> Hi,
>
> I am trying to call stored procedure from spring-ibatis dao.
> My code is like this
>
> SqlMap.xml
>        <parameterMap class="java.util.Map" id="UPSERT_PM_PRECEDENCE_MAP">
>                <parameter property="skuid_var" javaType="java.lang.String"
> jdbcType="VARCHAR2" mode="IN" />
>                <parameter property="pm_col_name"
> javaType="java.lang.String"
> jdbcType="VARCHAR2" mode="IN" />
>                <parameter property="prec_master_col_name"
> javaType="java.lang.String"
> jdbcType="VARCHAR2" mode="IN" />
>                <parameter property="new_source"
> javaType="java.lang.Integer"
> jdbcType="NUMBER" mode="IN" />
>                <parameter property="col_value" javaType="java.lang.String"
> jdbcType="VARCHAR2" mode="IN" />
>        </parameterMap>
>
>        <procedure id="UPSERT_PM_PRECEDENCE"
> parameterMap="UPSERT_PM_PRECEDENCE_MAP">
>                {call
>
> UPSERT_PM_PRECEDENCE(#skuid_var#,#pm_col_name#,#prec_master_col_name#,#new_source#,#col_value#)}
>        </procedure>
>
> DaoIMpl
>         Map<String, object> hashMap = new HashMap<String, Object>();
>          hashMap.put("skuid_var", prodmDatPm.getSkuid());
>          hashMap.put("pm_col_name", pmColumnName);
>          hashMap.put("prec_master_col_name", precedenceColName);
>          hashMap.put("new_source", 20);
>          hashMap.put("col_value", col_value);
>          getSqlMapClientTemplate().update("UPSERT_PM_PRECEDENCE", hashMap);
>
> Error
>
> Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in
>
> co/za/exclusive/ecm/dao/ibatis/productmaster/PRODUCTMASTER_PRODM_AUX_PRECEDENCE_SQLMap.xml.
> --- The error occurred while applying a parameter map.
> --- Check the PRODM_AUX_PRECEDENCE.UPSERT_PM_PRECEDENCE_MAP.
> --- Check the parameter mapping for the 'skuid_var' property.
> --- Cause: java.sql.SQLException: Invalid column index
>        at
>
> com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeUpdate(MappedStatement.java:107)
>        at
>
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.update(SqlMapExecutorDelegate.java:457)
>        at
>
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.update(SqlMapSessionImpl.java:90)
>        at
>
> org.springframework.orm.ibatis.SqlMapClientTemplate$10.doInSqlMapClient(SqlMapClientTemplate.java:413)
>        at
>
> org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:209)
>        ... 116 more
> Caused by: java.sql.SQLException: Invalid column index
>        at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
>        at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
>        at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
>        at
>
> oracle.jdbc.driver.OraclePreparedStatement.setStringInternal(OraclePreparedStatement.java:5360)
>        at
>
> oracle.jdbc.driver.OracleCallableStatement.setString(OracleCallableStatement.java:4576)
>        at
>
> org.apache.commons.dbcp.DelegatingPreparedStatement.setString(DelegatingPreparedStatement.java:131)
>        at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)
>        at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
>
> com.ibatis.common.jdbc.logging.PreparedStatementLogProxy.invoke(PreparedStatementLogProxy.java:70)
>        at $Proxy15.setString(Unknown Source)
>        at
>
> com.ibatis.sqlmap.engine.type.StringTypeHandler.setParameter(StringTypeHandler.java:30)
>        at
>
> com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap.setParameter(ParameterMap.java:166)
>        at
>
> com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap.setParameters(ParameterMap.java:126)
>        at
>
> com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdateProcedure(SqlExecutor.java:227)
>        at
>
> com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteUpdate(ProcedureStatement.java:34)
>        at
>
> com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeUpdate(MappedStatement.java:94)
>        ... 120 more
>
>
> Please help if any body knows the reason.
>
> Thanks and Regards
> Rs
> --
> View this message in context:
> http://old.nabble.com/The-error-occurred-while-applying-a-parameter-map.-tp27241705p27241705.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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