ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim <deadmo...@gmail.com>
Subject Re: Spring, Ibatis & Oracle 10G
Date Mon, 06 Oct 2008 19:42:41 GMT
* <parameterMap id ="aParameterMap"  class="map">
           <parameter property="parameter7" jdbcType="ORACLECURSOR"
mode="OUT" resultMap="mapToClass"/>
     </parameterMap>

<procedure id="aStoredProcCall" parameterMap="aParameterMap">
           {call get_some_data(?) }
     </procedure>

 List data =getSqlMapClientTemplate().queryForList("aStoredProcCall",map);*

'data' variable will always be null after this operation (reason I stated in
the previous reply). To get the OUT parameter you need to

*Map map = new HashMap();*
*getSqlMapClientTemplate().update("aStoredProcCall",map); //or queryForList
if you like, which is more confusing
Object param = map.get('parameter7')*

You don't need to put anything under OUT parameter keys in the parameter map
as they will be overwritten anyway.

I'm not sure about oraclecursor typing, as I haven't had any experience with
it. If I recall correctly, cursors can be handled as resultsets, but this
needs to be verified.

What do you mean by
*>The cursor output parameter needs to be passed into the stored proc as an*
* >input parameter.*
?
Does it need to be passed to another procedure, which is called after this
one? Do you already have a cursor and want to pass it as an INOUT parameter?
*
**>Have viewed examples where procedures are declared with following
notation*
* >     ? = call proc (?,?,?,?,?,?)*
* >Have attempted this also and get wrong number of types or arguments.*
*
*have you added another parameter to the parameterMap? There must be the
same number of question marks and parameters in the parameterMap (just like
using jdbc)

On Mon, Oct 6, 2008 at 12:10 PM, <lucy.x.cameron@jpmorgan.com> wrote:

>
> Thanks 4 the reply ... I know the procedure isn't returning data ... my
> question is, can you see  anything wrong with the way i've set my sql maps
> & related config that is subsequently causing no data to be returned?
> The cursor output parameter needs to be passed into the stored proc as an
> input parameter. Do I need to include the cursor parameter in the map I
> construct  ? And if so what would value would i give it ?  (I've tried null
> but makes no difference)
> I also attempted setting the cursor mode=INOUT I get an unsupported feature
> error.
>
> Have viewed examples where procedures are declared with following notation
>
>      ? = call proc (?,?,?,?,?,?)
>
> Have attempted this also and get wrong number of types or arguments.
>
> Any advice much appreciated.
>
> Thanks.
>
>
>
>
>
>             Vadim
>             <deadmoro3@gmail.
>             com>                                                       To
>                                       user-java@ibatis.apache.org
>             03/10/2008 16:47                                           cc
>
>                                                                   Subject
>             Please respond to         Re: Spring, Ibatis & Oracle 10G
>             user-java@ibatis.
>                apache.org
>
>
>
>
>
>
>
>
> You are querying for list - Ibatis tries to map resultset obtained after
> the call, which is absent, so you get no data. You should use
> sqlMapTemplate().update("procedure", params) and check for the out
> parameter in the 'params', under the key specified in the sqlmap.xml
> parameterMap (aParameterMap in your case) associated with that procedure.
>
> On Fri, Oct 3, 2008 at 2:12 PM, <lucy.x.cameron@jpmorgan.com> wrote:
>  Hi,
>
>  I'm using spring &  ibatis sql maps  to call an Oracle (10G) stored
>  procedure. I can successfully call the stored proc from sql plus however
>  when I use my code I get no data returned and no error thrown.
>  The stored procedure  takes in 7 parameters -  6 input and 1 output, the
>  output being a of type sys_refcursor. I can't see where I'm going
>  wrong...
>  is there a way I can debug to see exactly whats being called ? Or am I
>  handling the cursor incorrectly ? Or is my application context incorrect
>  ?
>
>  here's my sql map relating to the proc (mapToClass is just a java bean
>  representing )
>
>
>       <parameterMap id ="aParameterMap"  class="map">
>
>             <parameter property="parameter1" jdbcType="VARCHAR" javaType=
>  "java.lang.String" mode="IN"/>
>             <parameter property="parameter2" jdbcType="DATE" javaType=
>  "java.util.Date" mode="IN"/>
>             <parameter property="parameter3" jdbcType="VARCHAR" javaType=
>  "java.lang.String" mode="IN"/>
>             <parameter property="parameter4" jdbcType="VARCHAR" javaType=
>  "java.lang.String" mode="IN"/>
>             <parameter property="parameter5" jdbcType="VARCHAR" javaType=
>  "java.lang.String" mode="IN"/>
>             <parameter property="parameter6" jdbcType="CHAR" javaType=
>  "java.lang.String" mode="IN"/>
>             <parameter property="parameter7" jdbcType="ORACLECURSOR" mode=
>  "OUT" resultMap="mapToClass"/>
>
>       </parameterMap>
>
>       <procedure id="aStoredProcCall" parameterMap="aParameterMap">
>             {call get_some_data(?, ?, ?, ?, ?, ?, ?) }
>       </procedure>
>
>  The java code
>
>
>
>         Map map = new HashMap();
>
>         map.put("parameter1", "valueparameter1");
>         map.put("parameter2", "valueparameter2");
>         map.put("parameter3", "valueparameter3");
>         map.put("parameter4", "valueparameter4");
>         map.put("parameter5", "valueparameter5");
>         map.put("parameter6", "valueparameter6");
>
>
>       List data
>  =getSqlMapClientTemplate().queryForList("aStoredProcCall",map);
>
>  ApplicationOnContext
>
>       <bean id="sqlMapClient"
>
>  class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
>             <property name="configLocation"
>                   value="classpath:sqlmap-config.xml" />
>             <property name="dataSource" ref="dataSource" />
>       </bean>
>
>       <bean id="theDao"
>             class="the.java.class.that.calls.queryforlist()">
>             <property name="sqlMapClient" ref="sqlMapClient" />
>       </bean>
>
>
>
>
>  Generally, this communication is for informational purposes only
>  and it is not intended as an offer or solicitation for the purchase
>  or sale of any financial instrument or as an official confirmation
>  of any transaction. In the event you are receiving the offering
>  materials attached below related to your interest in hedge funds or
>  private equity, this communication may be intended as an offer or
>  solicitation for the purchase or sale of such fund(s).  All market
>  prices, data and other information are not warranted as to
>  completeness or accuracy and are subject to change without notice.
>  Any comments or statements made herein do not necessarily reflect
>  those of JPMorgan Chase & Co., its subsidiaries and affiliates.
>
>  This transmission may contain information that is privileged,
>  confidential, legally privileged, and/or exempt from disclosure
>  under applicable law. If you are not the intended recipient, you
>  are hereby notified that any disclosure, copying, distribution, or
>  use of the information contained herein (including any reliance
>  thereon) is STRICTLY PROHIBITED. Although this transmission and any
>  attachments are believed to be free of any virus or other defect
>  that might affect any computer system into which it is received and
>  opened, it is the responsibility of the recipient to ensure that it
>  is virus free and no responsibility is accepted by JPMorgan Chase &
>  Co., its subsidiaries and affiliates, as applicable, for any loss
>  or damage arising in any way from its use. If you received this
>  transmission in error, please immediately contact the sender and
>  destroy the material in its entirety, whether in electronic or hard
>  copy format. Thank you.
>  Please refer to http://www.jpmorgan.com/pages/disclosures for
>  disclosures relating to UK legal entities.
>
>
> Generally, this communication is for informational purposes only
> and it is not intended as an offer or solicitation for the purchase
> or sale of any financial instrument or as an official confirmation
> of any transaction. In the event you are receiving the offering
> materials attached below related to your interest in hedge funds or
> private equity, this communication may be intended as an offer or
> solicitation for the purchase or sale of such fund(s).  All market
> prices, data and other information are not warranted as to
> completeness or accuracy and are subject to change without notice.
> Any comments or statements made herein do not necessarily reflect
> those of JPMorgan Chase & Co., its subsidiaries and affiliates.
>
> This transmission may contain information that is privileged,
> confidential, legally privileged, and/or exempt from disclosure
> under applicable law. If you are not the intended recipient, you
> are hereby notified that any disclosure, copying, distribution, or
> use of the information contained herein (including any reliance
> thereon) is STRICTLY PROHIBITED. Although this transmission and any
> attachments are believed to be free of any virus or other defect
> that might affect any computer system into which it is received and
> opened, it is the responsibility of the recipient to ensure that it
> is virus free and no responsibility is accepted by JPMorgan Chase &
> Co., its subsidiaries and affiliates, as applicable, for any loss
> or damage arising in any way from its use. If you received this
> transmission in error, please immediately contact the sender and
> destroy the material in its entirety, whether in electronic or hard
> copy format. Thank you.
> Please refer to http://www.jpmorgan.com/pages/disclosures for
> disclosures relating to UK legal entities.
>

Mime
View raw message