Announcement Announcement Module
Collapse
No announcement yet.
spring ibatis stored procedure call on sql server ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring ibatis stored procedure call on sql server ?

    Keeping me busy and can't seem to solve it so easily, I'm trying to call a SQL Server 2000 stored procedure that sets an output parameter using Spring iBATIS support.

    I use Spring 1.2.3 and iBATIS 2.0, the xml map looks like this:

    Code:
    <parameterMap id="lpFilter" class="java.util.Map">
            <parameter property="triggerId" />
            <parameter property="charge" />
            <parameter property="logicalPortId" jdbcType="INTEGER" javaType="java.lang.Integer" mode="OUT" />
    </parameterMap>
    
    <procedure id="findLogicalPortId" parameterMap="lpFilter">
            &#123;call sp_test &#40;?, ?, ?&#41;&#125;
    </procedure>
    I call it like this in my SqlMap implementation class (I think the problem is there somewhere) :
    Code:
    getSqlMapClientTemplate&#40;&#41;.update&#40;"findLogicalPortId", map&#41;;
    Object obj = map.get&#40;"logicalPortId"&#41;;
    System.out.println&#40;obj&#41;; // results in null
    The iBATIS documentation says that the parameter object (here "lpFilter") should be changed, but it isn't, the result is simply null.

    What am I doing wrong ? Should I use the Spring JDBC approach for this ?

    Thx,
    M

  • #2
    I would try the following:

    1. Specify a resultClass of INTEGER for the procedure "findLogicalPortId".
    2. Change the line

    getSqlMapClientTemplate().update("findLogicalPortI d", map);

    to be
    Integer logicalPortId = (Integer)getSqlMapClientTemplate().update("findLog icalPortId", map);

    HTH.

    Daniel

    Comment

    Working...
    X