And of course add a suitable numRows property to your Java custom class
BuildControlObject.

ibatis will only need property getters for the inputs and only a setter for
your one output member. You can make all the members public for convenience
of your Java code to access.

(I often make these custom parameterMap classes as inner private static
final classes as they often have utility limited to just the scope of the
code that is making the stored procedure call.)

--Roger

On Fri, Jan 2, 2009 at 9:55 PM, Roger Voss <[email protected]> wrote:

> For a single custom Java class you can have a single ibatis parameterMap
> that maps both inputs (mode="IN") and outputs (mode="OUT") to the stored
> procedure call - or even have class members that are both (mode="INOUT").
>
> Place your output <parameter property="numRows"/> as the last item in your
> <parameterMap  id="parameterTest"/> (I'm assuming your last positional
> argument is the OUT argument.)
>
> Then change your <procedure id="BUILD_CONTROL_INSERT"/> to specify:
>
> parameterMap="parameterTest"
>
> --RogerV
>
>
> On Fri, Jan 2, 2009 at 5:50 AM, Sudhakar Kanagarajan <
> [email protected]> wrote:
>
>>
>> I have an Oracle stored procedure that inserts a row into a table from a
>> set
>> of input parameters and returns a number back.
>>
>> I want to map the input parameters to a Java object and return the output
>> parameter as Integer.
>>
>> I am not able to achieve this since the Ibatis Paramerter Map always
>> expects
>> a Map or a custom java object and not both.
>>
>> Is it possible to achieve this? I have attached the Ibatis config below
>>
>> <parameterMap  id="parameterTest"
>> class="com.fmrco.compliance.ace.builder.control.BuildControlObject" >
>>    <parameter property="buildRunId" jdbcType="NUMBER"
>> javaType="java.lang.Long" mode="IN"/>
>>    <parameter property="ruleKeyId" jdbcType="NUMBER"
>> javaType="java.lang.Long" mode="IN"/>
>>    <parameter property="ruleVerNum" jdbcType="NUMBER"
>> javaType="java.lang.Long" mode="IN"/>
>>    <parameter property="dataLoadId" jdbcType="NUMBER"
>> javaType="java.lang.Long" mode="IN"/>
>>    <parameter property="buildTypeRefId" jdbcType="NUMBER"
>> javaType="java.lang.Long" mode="IN"/>
>>    <parameter property="buildStatusRefId" jdbcType="NUMBER"
>> javaType="java.lang.Long" mode="IN"/>
>>    <parameter property="buildComment" jdbcType="VARCHAR"
>> javaType="java.lang.String" mode="IN"/>
>>    <parameter property="addUsrId" jdbcType="VARCHAR"
>> javaType="java.lang.String" mode="IN"/>
>> </parameterMap>
>>
>> <parameterMap id="test" class="map" >
>>       <parameter property="inputs" typeName="parameterTest"  />
>>       <parameter property="numRows" jdbcType="VARCHAR"
>> javaType="java.lang.Long" mode="OUT"/>
>> </parameterMap>
>>
>> <procedure id="BUILD_CONTROL_INSERT" parameterMap="test"
>> resultClass="java.lang.Long">
>>   {call BUILD_CONTROL_INSERT(?,?,?,?,?,?,?,?,?)}
>> </procedure>
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Spring---Ibatis-Stored-Procedure-Call-tp21251633p21251633.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>

Reply via email to