ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher.Mathru...@sybase.com
Subject Re: stored procedure specify parameter...
Date Wed, 14 May 2008 05:12:05 GMT
Hi Josh,

This looks surprisingly similar to Sybase ASE syntax. I can assure you 
that iBatis works quite well with this syntax as I use it quite regularly 
although I usually avoid the use of the parameterMap. I use the following:

  <procedure id="listShipDestination" parameterClass="ShipDestination" 
    { call ${listShipDestination_sp} (
        @CustomerNumber = 
      , @BillToLocation = 
      , @SoldToLocation = 

      <isNotEmpty property="destLocation">
        , @DestLocation = 



I have numerous stored procs that I do this with. iBatis does nothing 
special with your SQL, it simply passes it off to JDBC and executes it as 
you define it. 

I hope this helps you..


"Josh Joy" <joshjdevl@gmail.com> 
Sent by: josh.joy.123@gmail.com
05/13/2008 08:03 PM
Please respond to


stored procedure specify parameter...


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

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"/> 
    <procedure id="spFetchSomeData" 
parameterMap="spFetchSomeData-parameterMap" >
        {call spFetchSomeData (?, ?, ?, ?)}

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...


View raw message