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 Mike Altieri <mc...@yahoo.com> on 2008/02/20 21:57:23 UTC

paremeter map and smallint

Hi I am trying to call a stored procedure using Ibatis's sql mapping on WebSphere 6.1 connected to a container managed datasource that is a  msft sqlserver2000 db (I have called other stored procedures fine but the smallint is screwing me up)...

this SP declaration is something like this:

CREATE PROCEDURE SOME_SP (@SOMECHARS    CHAR(9),   @SOME_SMALLINT         SMALLINT OUTPUT ,.......

in my mapping xml I have the following (and a resultmap declaration as well):

<parameterMap id="defaultParameters" class="map" >
    <parameter property="someChars" javaType="java.lang.String" mode="IN"/>
    <parameter property="someSmallInt" jdbcType="java.sql.Types.SMALLINT" javaType="java.lang.Integer" mode="OUT"/>
  </parameterMap>
  
 

  <procedure id="getList" parameterMap="defaulParameters" resultMap="someResultMap" >
    EXEC SOME_SP ?,?
  </procedure>

Then in my ListSqlMapDao I have the following method being called:

public List getSomeList() {
        
        Map paramMap = new HashMap(10);
        
        String someChars = new String;
        Integer someSmallInt = new Integer(java.sql.Types.SMALLINT);
                
        paramMap.put("someChars", someChars);
        paramMap.put("someSmallInt", someSmallInt);
        
        return queryForList("getList", paramMap);
    }

when this method is called I get the following exception...

Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in com/perficient/coe/dao/ibatis/maps/OrderList.xml.  
--- The error occurred while executing query procedure.  
--- Check the EXEC PO_HdrData_S_SP ?,?,?,?,?,?,?,?,?.  
--- Check the output parameters (register output parameters failed).  
--- Cause: java.sql.SQLException: [IBM][SQLServer JDBC Driver]Invalid parameter binding(s).
    at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:185)
    at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:615)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589)
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
    at org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:298)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:209)
    ... 86 more
Caused by: java.sql.SQLException: [IBM][SQLServer JDBC Driver]Invalid parameter binding(s).

I can't change the smallInt call in the storedprocedure since other programs use this - but am free to change the call as much as i need

Thanks!