ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Josh Joy" <joshjd...@gmail.com>
Subject stored procedure specify parameter...
Date Wed, 14 May 2008 03:03:41 GMT
Hi,

I looked through the documentation, though I most likely missed it
somewhere...

If i have a stored procedure, in sql I would execute as follows...

EXECUTE spFetchSomeData @parm1=1, @parm2=2, @parm3=3, @parm4=4

So all 4 parameters are integers..

This is how I write it in ibatis...
    <parameterMap id="spFetchSomeData-parameterMap" class="com.myobject" >
        <parameter property="parm1" jdbcType="INTEGER"
            javaType="java.lang.Long" mode="IN"/>
        <parameter property="parm2" jdbcType="NUMERIC"
            javaType="java.lang.Long" mode="IN"/>
        <parameter property="parm3" jdbcType="NUMERIC"
            javaType="java.lang.Long" mode="IN"/>
        <parameter property="parm4" jdbcType="NUMERIC"
            javaType="java.lang.Long" mode="IN"/>
    </parameterMap>

    <procedure id="spFetchSomeData"
parameterMap="spFetchSomeData-parameterMap" >
        {call spFetchSomeData (?, ?, ?, ?)}
    </procedure>

So my class "com.myobject" has java properties parm1,parm2,parm3,parm4 to
coincide with my stored procedure.
If I understand this correctly, when spFetchSomeData is called, it is passed
the paramters from spFetchSomeData-parameterMap in order...

My only question is, can I specify not to rely on the order of the
parameters. Similar to the sql execute above, is there a way to specify the
stored procedure parameters and map those to my bean?

I'm sure I just probably missed the syntax somewhere...

Thanks
Josh

Mime
View raw message