ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: Call Stored Procedure Returning Multiple Values
Date Tue, 22 Aug 2006 17:40:59 GMT
Ahh - the SP must return a result set.  One input parameter, no output
parameters.  So set up a result map in iBATIS, then call it with
queryForList().

Jeff Butler


On 8/22/06, Brad Balmer <bbalmer@peapod.com> wrote:
>
>  Thanks.
>
> Right before I received this I was told that I needed to call this SP just
> like calling any normal SQL select statement.  Now I've got to figure out
> how to do that.
>
>
> Jeff Butler wrote:
>
> If the procedure has three parameters (one in, two out), then you need to
> call the procedure like this:
>
>  <procedure id="selectTargetMessages"
> parameterMap="targetMessageParameters" remapResults="true">
>          {*call pip_invc_msg_targ_chk (?,?,?)*}
>    </procedure>
>
> Jeff Butler
>
>
> On 8/22/06, Brad Balmer <bbalmer@peapod.com> wrote:
> >
> > I'm getting the following error:
> > Function doesn't have an output parameter or the out parameter isn't
> > returned.
> >
> > How can I map multiple Strings coming back from a stord procedure?
> >
> > <code>
> >    public String[] selectTargetMessages(String pnOrdId) {
> >        Map values = new HashMap(3);
> >        values.put ("ordId", pnOrdId);
> >
> > getSqlMapClientTemplate().queryForObject("customer.selectTargetMessages
> > ",
> > values);
> >        String lsFirst = (String)values.get("first");
> >        String lsSecond = (String)values.get("second");
> >        String[] loResult = new String[2];
> >        loResult[0] = lsFirst;
> >        loResult[1] = lsSecond;
> >        return(loResult);
> >    }
> >
> >    <parameterMap id="targetMessageParameters" class=" java.util.HashMap"
> > >
> >          <parameter property="first" jdbcType="VARCHAR"
> > javaType="java.lang.String" mode="OUT"/>
> >          <parameter property="second" jdbcType="VARCHAR"
> > javaType="java.lang.String" mode="OUT"/>
> >          <parameter property="ordId" jdbcType="VARCHAR"
> > javaType="java.lang.String" mode="IN"/>
> >    </parameterMap>
> >
> >    <procedure id="selectTargetMessages"
> > parameterMap="targetMessageParameters" remapResults="true">
> >          {call pip_invc_msg_targ_chk (?)}
> >    </procedure>
> >
> > </code>
> >
> > ___________________________
> > Brad Balmer
> > Application Architect
> > Peapod, Inc.
> > 847-583-6306
> >
> > This email may contain confidential or legally privileged information
> > that is intended only for the individual or entity named as the
> > recipient. If you are not the intended recipient, you are hereby
> > notified that any disclosure, copying, distribution, or reliance upon
> > the contents of this email is strictly prohibited. If you have received
> > this email in error, please contact the sender so that proper delivery
> > can be arranged, and then please delete this message. Thank you.
> >
> >
> >
> >
>
> --
>
> ___________________________
> Brad Balmer
> Application Architect
> Peapod, Inc.
> 847-583-6306
>
> This email may contain confidential or legally privileged information that is intended
only for the individual or entity named as the recipient. If you are not the intended recipient,
you are hereby notified that any disclosure, copying, distribution, or reliance upon the contents
of this email is strictly prohibited. If you have received this email in error, please contact
the sender so that proper delivery can be arranged, and then please delete this message. Thank
you.
>
>

Mime
View raw message