In your call you have 5 ‘?’s which means that you should have 5 parameters in your parameter map.

If one of your parameters are OUT or INOUT just set mode in parameter map.

I think IBATIS should populate OUT or INOUT parameters into parameter map object after execution.

 

Result map should be used if your procedure have selects which contains flubId, …. columns.

 

Do not use result map if you have more than one select or you have updates or inserts in your procedure.

 

If you just read JDBC specification, you can find a lot of good code examples.

After that you can understand this work flow much better.

 

Best,

Aram

 


From: Robert Campbell [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 09, 2006 7:42 PM
To: iBatis
Subject: Stored procedure return value?

 

I'm trying to call a stored procedure. I pass it an object, it returns an object of the same type. Except it doesn't work.

    <parameterMap id="addParam" class="flubWall">
         <parameter property="flubId" jdbcType="NUMBER" javaType=" java.lang.Integer" mode="IN"/>
        <parameter property="flubName" jdbcType="VARCHAR" javaType="java.lang.String" mode="IN" />
        <parameter property="id" jdbcType="NUMBER" javaType=" java.lang.Integer" mode="IN"/>
        <parameter property="wallId" jdbcType="NUMBER" javaType="java.lang.Integer" mode="IN"/>
        <parameter property="wallName" jdbcType="VARCHAR" javaType=" java.lang.String" mode="IN" />
    </parameterMap>


    <resultMap id="flubWallResult" class="flubWall">
        <result property="flubId" column="FLUB_ID"/>
        <result property="flubName" column="FLUB_NAME"/>
        <result property="id" column="FLUB_WALL_ID" />
        <result property="wallId" column="WALL_ID" />
        <result property="wallName" column="WALL_NAME"/>
    </resultMap>
   
   
    <procedure id="submitFlubWall"
        parameterMap="addParam"
        resultMap="flubWallResult">
        {call FLUB_PROTO.flub_wall_tst.submit_flub_wall (?, ?, ?, ?, ?)}
    </procedure> 


Now this doesn't work.. I would expect the call to return a ResultSet which gets mapped by the resultMap into a new flubWall object. This doesn't happen. So I tried this:

Added as first parameter listed in the parameterMap:
        <parameter property="output1" jdbcType="ORACLECURSOR" mode="OUT" />

Changed to:
        {? = call FLUB_PROTO.flub_wall_tst.submit_flub_wall (?, ?, ?, ?, ?)} 

This also doesn't work, I get this error as I expected:
       There is no READABLE property named 'output1' in class 'com.blah.flubWall'


So how to do it? I saw examples where an object is mapped to a Map, then the Map is passed to the paramterMap, but that doesn't seem right.. it's like rewriting what iBatis should be doing...

Reply via email to