Results 1 to 2 of 2

Thread: spring ibatis stored procedure call on sql server ?

  1. #1
    Join Date
    Oct 2004
    Location
    Belgium
    Posts
    27

    Default 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. #2
    Join Date
    Jan 2006
    Posts
    20

    Default

    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

Similar Threads

  1. Replies: 3
    Last Post: Dec 2nd, 2010, 08:34 AM
  2. Replies: 5
    Last Post: Mar 7th, 2006, 09:17 AM
  3. Spring + postgres + stored procedure
    By spring_dummy in forum Data
    Replies: 6
    Last Post: Feb 27th, 2006, 03:02 PM
  4. Replies: 0
    Last Post: May 11th, 2005, 06:11 AM
  5. Replies: 1
    Last Post: Sep 24th, 2004, 03:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •