MyBatis and Oracle Stored Procedures with multiple output variables

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

MyBatis and Oracle Stored Procedures with multiple output variables

Jan Žanda
Hi guys,

Can you please explain to me, how MyBatis works when you call a
procedure with multiple output variables?

I have procedure like this:

 PROCEDURE inq_lov_sex(p_sex_id    IN
profile_lov_client_sex.client_sex_id%TYPE,
                        rcu_out     OUT rcu_lov_sex,
                        result_code OUT VARCHAR2,
                        error_code  OUT VARCHAR2,
                        error_desc  OUT VARCHAR2)

and I canot find out, how to map it correctly. In mapper, I use this:

<select id="procedureCall" statementType="CALLABLE">
                {call
                ODS_APPL_PKG.inq_lov_sex(
                #{sexId,jdbcType=VARCHAR,mode=IN},
                #{rcuOut,mode=OUT,jdbcType=CURSOR},
                #{resultCode,mode=OUT,jdbcType=VARCHAR},
                #{errorCode,mode=OUT,jdbcType=VARCHAR},
                #{errorDesc,mode=OUT,jdbcType=VARCHAR})}
</select>

I was trying few hours to map it somehow, but no result.
Could you please anyone post an example, how to correctly handle these
situations? There is absolutely nothing in the documentation about
stored procedures.
Reply | Threaded
Open this post in threaded view
|

RE: MyBatis and Oracle Stored Procedures with multiple output variables

Poitras Christian
I don't have an example, but make sure that the OUT parameters in your mapper are beans and not final parameters like int or String.

This should work:
Public void procedureCall (@Param("sexId") String sexId, @Param("outParameters") Map<String, Object> outParameters);

<select id="procedureCall" statementType="CALLABLE">
                {call
                ODS_APPL_PKG.inq_lov_sex(
                #{sexId,jdbcType=VARCHAR,mode=IN},
                #{outParameters.rcuOut,mode=OUT,jdbcType=CURSOR},
                #{outParameters.resultCode,mode=OUT,jdbcType=VARCHAR},
                #{outParameters.errorCode,mode=OUT,jdbcType=VARCHAR},
                #{outParameters.errorDesc,mode=OUT,jdbcType=VARCHAR})}
</select>

You will also need to convert the CURSOR into some actual object. You could use resultMap.
#{outParameters.rcuOut,mode=OUT,jdbcType=CURSOR,resultMap=my_map},

-----Message d'origine-----
De : [hidden email] [mailto:[hidden email]] De la part de Jan Žanda
Envoyé : September-03-10 11:00 AM
À : mybatis-user
Objet : MyBatis and Oracle Stored Procedures with multiple output variables

Hi guys,

Can you please explain to me, how MyBatis works when you call a
procedure with multiple output variables?

I have procedure like this:

 PROCEDURE inq_lov_sex(p_sex_id    IN
profile_lov_client_sex.client_sex_id%TYPE,
                        rcu_out     OUT rcu_lov_sex,
                        result_code OUT VARCHAR2,
                        error_code  OUT VARCHAR2,
                        error_desc  OUT VARCHAR2)

and I canot find out, how to map it correctly. In mapper, I use this:

<select id="procedureCall" statementType="CALLABLE">
                {call
                ODS_APPL_PKG.inq_lov_sex(
                #{sexId,jdbcType=VARCHAR,mode=IN},
                #{rcuOut,mode=OUT,jdbcType=CURSOR},
                #{resultCode,mode=OUT,jdbcType=VARCHAR},
                #{errorCode,mode=OUT,jdbcType=VARCHAR},
                #{errorDesc,mode=OUT,jdbcType=VARCHAR})}
</select>

I was trying few hours to map it somehow, but no result.
Could you please anyone post an example, how to correctly handle these
situations? There is absolutely nothing in the documentation about
stored procedures.
Reply | Threaded
Open this post in threaded view
|

Re: MyBatis and Oracle Stored Procedures with multiple output variables

Jan Žanda
thanks a lot,

About that beans - you mean to create wrapper objects?
I guess this is one of the things that should really be pointed out in
the doc.

Honza

On 3 zář, 17:24, Poitras Christian <[hidden email]>
wrote:

> I don't have an example, but make sure that the OUT parameters in your mapper are beans and not final parameters like int or String.
>
> This should work:
> Public void procedureCall (@Param("sexId") String sexId, @Param("outParameters") Map<String, Object> outParameters);
>
> <select id="procedureCall" statementType="CALLABLE">
>                 {call
>                 ODS_APPL_PKG.inq_lov_sex(
>                 #{sexId,jdbcType=VARCHAR,mode=IN},
>                 #{outParameters.rcuOut,mode=OUT,jdbcType=CURSOR},
>                 #{outParameters.resultCode,mode=OUT,jdbcType=VARCHAR},
>                 #{outParameters.errorCode,mode=OUT,jdbcType=VARCHAR},
>                 #{outParameters.errorDesc,mode=OUT,jdbcType=VARCHAR})}
> </select>
>
> You will also need to convert the CURSOR into some actual object. You could use resultMap.
> #{outParameters.rcuOut,mode=OUT,jdbcType=CURSOR,resultMap=my_map},
>
> -----Message d'origine-----
> De : [hidden email] [mailto:[hidden email]] De la part de Jan Žanda
> Envoyé : September-03-10 11:00 AM
> À : mybatis-user
> Objet : MyBatis and Oracle Stored Procedures with multiple output variables
>
> Hi guys,
>
> Can you please explain to me, how MyBatis works when you call a
> procedure with multiple output variables?
>
> I have procedure like this:
>
>  PROCEDURE inq_lov_sex(p_sex_id    IN
> profile_lov_client_sex.client_sex_id%TYPE,
>                         rcu_out     OUT rcu_lov_sex,
>                         result_code OUT VARCHAR2,
>                         error_code  OUT VARCHAR2,
>                         error_desc  OUT VARCHAR2)
>
> and I canot find out, how to map it correctly. In mapper, I use this:
>
> <select id="procedureCall" statementType="CALLABLE">
>                 {call
>                 ODS_APPL_PKG.inq_lov_sex(
>                 #{sexId,jdbcType=VARCHAR,mode=IN},
>                 #{rcuOut,mode=OUT,jdbcType=CURSOR},
>                 #{resultCode,mode=OUT,jdbcType=VARCHAR},
>                 #{errorCode,mode=OUT,jdbcType=VARCHAR},
>                 #{errorDesc,mode=OUT,jdbcType=VARCHAR})}
> </select>
>
> I was trying few hours to map it somehow, but no result.
> Could you please anyone post an example, how to correctly handle these
> situations? There is absolutely nothing in the documentation about
> stored procedures.
Reply | Threaded
Open this post in threaded view
|

Re: MyBatis and Oracle Stored Procedures with multiple output variables

Jan Žanda
In reply to this post by Poitras Christian
I tried to do it the way you showed me, but I'm getting an exception:

Exception in thread "main"
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause:
org.apache.ibatis.reflection.ReflectionException: There is no getter
for property named 'outParameters' in 'class java.lang.String'
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### Cause: org.apache.ibatis.reflection.ReflectionException: There is
no getter for property named 'outParameters' in 'class
java.lang.String'
        at
org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:
8)
        at
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:
61)
        at
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:
53)
        at
org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:
38)
        at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:
66)
        at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:35)
        at $Proxy1.procedureCall(Unknown Source)
        at cz.trask.pokus.dbcaller.Caller.call(Caller.java:46)
        at cz.trask.pokus.dbcaller.Caller.main(Caller.java:18)
Caused by: org.apache.ibatis.reflection.ReflectionException: There is
no getter for property named 'outParameters' in 'class
java.lang.String'
        at
org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:
308)
        at
org.apache.ibatis.reflection.MetaClass.getGetInvoker(MetaClass.java:
93)
        at
org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:
131)
        at
org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:
27)
        at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:
103)
        at
org.apache.ibatis.reflection.MetaObject.metaObjectForProperty(MetaObject.java:
125)
        at org.apache.ibatis.reflection.MetaObject.setValue(MetaObject.java:
110)
        at
org.apache.ibatis.executor.resultset.FastResultSetHandler.handleOutputParameters(FastResultSetHandler.java:
65)
        at
org.apache.ibatis.executor.statement.CallableStatementHandler.query(CallableStatementHandler.java:
44)
        at
org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:
55)
        at
org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:
41)
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:
95)
        at
org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:
72)
        at
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:
59)
        ... 7 more



How am I supposed to make sure, that the non-cursor parameters are
beans? I have mapping:


<resultMap type="cz.trask.pokus.dbcaller.OutputParameters"
                id="lovSexMap">
                <result property="resultCode" column="outParameters.resultCode" />
                <result property="errorCode" column="outParameters.errorCode" />
                <result property="errorDesc" column="outParameters.errorDesc" />
                <collection property="outParameters.rcuOut"
ofType="cz.trask.pokus.dbcaller.LovSex">
                        <id property="clientSexId" column="CLIENT_SEX_ID" />
                        <result property="descriptionCz" column="DESCRIPTION_CZ" />
                        <result property="descriptionSk" column="DESCRIPTION_SK" />
                        <result property="descriptionEn" column="DESCRIPTION_EN" />
                        <result property="timestamp" column="TIMESTAMP" />
                        <result property="userId" column="USER_ID" />
                </collection>
        </resultMap>

This mapping is for the statement declaration as written in Your
answer.
What else should I do?




On 3 zář, 17:24, Poitras Christian <[hidden email]>
wrote:

> I don't have an example, but make sure that the OUT parameters in your mapper are beans and not final parameters like int or String.
>
> This should work:
> Public void procedureCall (@Param("sexId") String sexId, @Param("outParameters") Map<String, Object> outParameters);
>
> <select id="procedureCall" statementType="CALLABLE">
>                 {call
>                 ODS_APPL_PKG.inq_lov_sex(
>                 #{sexId,jdbcType=VARCHAR,mode=IN},
>                 #{outParameters.rcuOut,mode=OUT,jdbcType=CURSOR},
>                 #{outParameters.resultCode,mode=OUT,jdbcType=VARCHAR},
>                 #{outParameters.errorCode,mode=OUT,jdbcType=VARCHAR},
>                 #{outParameters.errorDesc,mode=OUT,jdbcType=VARCHAR})}
> </select>
>
> You will also need to convert the CURSOR into some actual object. You could use resultMap.
> #{outParameters.rcuOut,mode=OUT,jdbcType=CURSOR,resultMap=my_map},
>
> -----Message d'origine-----
> De : [hidden email] [mailto:[hidden email]] De la part de Jan Žanda
> Envoyé : September-03-10 11:00 AM
> À : mybatis-user
> Objet : MyBatis and Oracle Stored Procedures with multiple output variables
>
> Hi guys,
>
> Can you please explain to me, how MyBatis works when you call a
> procedure with multiple output variables?
>
> I have procedure like this:
>
>  PROCEDURE inq_lov_sex(p_sex_id    IN
> profile_lov_client_sex.client_sex_id%TYPE,
>                         rcu_out     OUT rcu_lov_sex,
>                         result_code OUT VARCHAR2,
>                         error_code  OUT VARCHAR2,
>                         error_desc  OUT VARCHAR2)
>
> and I canot find out, how to map it correctly. In mapper, I use this:
>
> <select id="procedureCall" statementType="CALLABLE">
>                 {call
>                 ODS_APPL_PKG.inq_lov_sex(
>                 #{sexId,jdbcType=VARCHAR,mode=IN},
>                 #{rcuOut,mode=OUT,jdbcType=CURSOR},
>                 #{resultCode,mode=OUT,jdbcType=VARCHAR},
>                 #{errorCode,mode=OUT,jdbcType=VARCHAR},
>                 #{errorDesc,mode=OUT,jdbcType=VARCHAR})}
> </select>
>
> I was trying few hours to map it somehow, but no result.
> Could you please anyone post an example, how to correctly handle these
> situations? There is absolutely nothing in the documentation about
> stored procedures.
Reply | Threaded
Open this post in threaded view
|

Re: MyBatis and Oracle Stored Procedures with multiple output variables

Jan Žanda
Never mind, I've got it working.

Thanks a lot.


Honza

On 6 zář, 10:13, Jan Žanda <[hidden email]> wrote:

> I tried to do it the way you showed me, but I'm getting an exception:
>
> Exception in thread "main"
> org.apache.ibatis.exceptions.PersistenceException:
> ### Error querying database.  Cause:
> org.apache.ibatis.reflection.ReflectionException: There is no getter
> for property named 'outParameters' in 'class java.lang.String'
> ### The error may involve defaultParameterMap
> ### The error occurred while setting parameters
> ### Cause: org.apache.ibatis.reflection.ReflectionException: There is
> no getter for property named 'outParameters' in 'class
> java.lang.String'
>         at
> org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:
> 8)
>         at
> org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:
> 61)
>         at
> org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:
> 53)
>         at
> org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:
> 38)
>         at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:
> 66)
>         at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:35)
>         at $Proxy1.procedureCall(Unknown Source)
>         at cz.trask.pokus.dbcaller.Caller.call(Caller.java:46)
>         at cz.trask.pokus.dbcaller.Caller.main(Caller.java:18)
> Caused by: org.apache.ibatis.reflection.ReflectionException: There is
> no getter for property named 'outParameters' in 'class
> java.lang.String'
>         at
> org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:
> 308)
>         at
> org.apache.ibatis.reflection.MetaClass.getGetInvoker(MetaClass.java:
> 93)
>         at
> org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:
> 131)
>         at
> org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:
> 27)
>         at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:
> 103)
>         at
> org.apache.ibatis.reflection.MetaObject.metaObjectForProperty(MetaObject.java:
> 125)
>         at org.apache.ibatis.reflection.MetaObject.setValue(MetaObject.java:
> 110)
>         at
> org.apache.ibatis.executor.resultset.FastResultSetHandler.handleOutputParameters(FastResultSetHandler.java:
> 65)
>         at
> org.apache.ibatis.executor.statement.CallableStatementHandler.query(CallableStatementHandler.java:
> 44)
>         at
> org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:
> 55)
>         at
> org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:
> 41)
>         at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:
> 95)
>         at
> org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:
> 72)
>         at
> org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:
> 59)
>         ... 7 more
>
> How am I supposed to make sure, that the non-cursor parameters are
> beans? I have mapping:
>
> <resultMap type="cz.trask.pokus.dbcaller.OutputParameters"
>                 id="lovSexMap">
>                 <result property="resultCode" column="outParameters.resultCode" />
>                 <result property="errorCode" column="outParameters.errorCode" />
>                 <result property="errorDesc" column="outParameters.errorDesc" />
>                 <collection property="outParameters.rcuOut"
> ofType="cz.trask.pokus.dbcaller.LovSex">
>                         <id property="clientSexId" column="CLIENT_SEX_ID" />
>                         <result property="descriptionCz" column="DESCRIPTION_CZ" />
>                         <result property="descriptionSk" column="DESCRIPTION_SK" />
>                         <result property="descriptionEn" column="DESCRIPTION_EN" />
>                         <result property="timestamp" column="TIMESTAMP" />
>                         <result property="userId" column="USER_ID" />
>                 </collection>
>         </resultMap>
>
> This mapping is for the statement declaration as written in Your
> answer.
> What else should I do?
>
> On 3 zář, 17:24, Poitras Christian <[hidden email]>
> wrote:
>
> > I don't have an example, but make sure that the OUT parameters in your mapper are beans and not final parameters like int or String.
>
> > This should work:
> > Public void procedureCall (@Param("sexId") String sexId, @Param("outParameters") Map<String, Object> outParameters);
>
> > <select id="procedureCall" statementType="CALLABLE">
> >                 {call
> >                 ODS_APPL_PKG.inq_lov_sex(
> >                 #{sexId,jdbcType=VARCHAR,mode=IN},
> >                 #{outParameters.rcuOut,mode=OUT,jdbcType=CURSOR},
> >                 #{outParameters.resultCode,mode=OUT,jdbcType=VARCHAR},
> >                 #{outParameters.errorCode,mode=OUT,jdbcType=VARCHAR},
> >                 #{outParameters.errorDesc,mode=OUT,jdbcType=VARCHAR})}
> > </select>
>
> > You will also need to convert the CURSOR into some actual object. You could use resultMap.
> > #{outParameters.rcuOut,mode=OUT,jdbcType=CURSOR,resultMap=my_map},
>
> > -----Message d'origine-----
> > De : [hidden email] [mailto:[hidden email]] De la part de Jan Žanda
> > Envoyé : September-03-10 11:00 AM
> > À : mybatis-user
> > Objet : MyBatis and Oracle Stored Procedures with multiple output variables
>
> > Hi guys,
>
> > Can you please explain to me, how MyBatis works when you call a
> > procedure with multiple output variables?
>
> > I have procedure like this:
>
> >  PROCEDURE inq_lov_sex(p_sex_id    IN
> > profile_lov_client_sex.client_sex_id%TYPE,
> >                         rcu_out     OUT rcu_lov_sex,
> >                         result_code OUT VARCHAR2,
> >                         error_code  OUT VARCHAR2,
> >                         error_desc  OUT VARCHAR2)
>
> > and I canot find out, how to map it correctly. In mapper, I use this:
>
> > <select id="procedureCall" statementType="CALLABLE">
> >                 {call
> >                 ODS_APPL_PKG.inq_lov_sex(
> >                 #{sexId,jdbcType=VARCHAR,mode=IN},
> >                 #{rcuOut,mode=OUT,jdbcType=CURSOR},
> >                 #{resultCode,mode=OUT,jdbcType=VARCHAR},
> >                 #{errorCode,mode=OUT,jdbcType=VARCHAR},
> >                 #{errorDesc,mode=OUT,jdbcType=VARCHAR})}
> > </select>
>
> > I was trying few hours to map it somehow, but no result.
> > Could you please anyone post an example, how to correctly handle these
> > situations? There is absolutely nothing in the documentation about
> > stored procedures.
Reply | Threaded
Open this post in threaded view
|

Re: MyBatis and Oracle Stored Procedures with multiple output variables

Chetan Nayak
Hello

I'm facing the same issue mentioned above.
I want to be able to send two OUT parameters as a part of the stored
procedure.
See my post here -http://groups.google.com/group/mybatis-user/
browse_thread/thread/14826bc31c9f143d
Your help would be greatly appreciated.



Thanks
Chetan



On Sep 6, 4:23 pm, Jan Žanda <[hidden email]> wrote:

> Never mind, I've got it working.
>
> Thanks a lot.
>
> Honza
>
> On 6 zář, 10:13, Jan Žanda <[hidden email]> wrote:
>
>
>
>
>
>
>
> > I tried to do it the way you showed me, but I'm getting an exception:
>
> > Exception in thread "main"
> > org.apache.ibatis.exceptions.PersistenceException:
> > ### Error querying database.  Cause:
> > org.apache.ibatis.reflection.ReflectionException: There is no getter
> > for property named 'outParameters' in 'class java.lang.String'
> > ### The error may involve defaultParameterMap
> > ### The error occurred while setting parameters
> > ### Cause: org.apache.ibatis.reflection.ReflectionException: There is
> > no getter for property named 'outParameters' in 'class
> > java.lang.String'
> >         at
> > org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactor y.java:
> > 8)
> >         at
> > org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlS ession.java:
> > 61)
> >         at
> > org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlS ession.java:
> > 53)
> >         at
> > org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSe ssion.java:
> > 38)
> >         at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:
> > 66)
> >         at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:35)
> >         at $Proxy1.procedureCall(Unknown Source)
> >         at cz.trask.pokus.dbcaller.Caller.call(Caller.java:46)
> >         at cz.trask.pokus.dbcaller.Caller.main(Caller.java:18)
> > Caused by: org.apache.ibatis.reflection.ReflectionException: There is
> > no getter for property named 'outParameters' in 'class
> > java.lang.String'
> >         at
> > org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:
> > 308)
> >         at
> > org.apache.ibatis.reflection.MetaClass.getGetInvoker(MetaClass.java:
> > 93)
> >         at
> > org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrappe r.java:
> > 131)
> >         at
> > org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:
> > 27)
> >         at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:
> > 103)
> >         at
> > org.apache.ibatis.reflection.MetaObject.metaObjectForProperty(MetaObject.ja va:
> > 125)
> >         at org.apache.ibatis.reflection.MetaObject.setValue(MetaObject.java:
> > 110)
> >         at
> > org.apache.ibatis.executor.resultset.FastResultSetHandler.handleOutputParam eters(FastResultSetHandler.java:
> > 65)
> >         at
> > org.apache.ibatis.executor.statement.CallableStatementHandler.query(Callabl eStatementHandler.java:
> > 44)
> >         at
> > org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingS tatementHandler.java:
> > 55)
> >         at
> > org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:
> > 41)
> >         at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:
> > 95)
> >         at
> > org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:
> > 72)
> >         at
> > org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlS ession.java:
> > 59)
> >         ... 7 more
>
> > How am I supposed to make sure, that the non-cursor parameters are
> > beans? I have mapping:
>
> > <resultMap type="cz.trask.pokus.dbcaller.OutputParameters"
> >                 id="lovSexMap">
> >                 <result property="resultCode" column="outParameters.resultCode" />
> >                 <result property="errorCode" column="outParameters.errorCode" />
> >                 <result property="errorDesc" column="outParameters.errorDesc" />
> >                 <collection property="outParameters.rcuOut"
> > ofType="cz.trask.pokus.dbcaller.LovSex">
> >                         <id property="clientSexId" column="CLIENT_SEX_ID" />
> >                         <result property="descriptionCz" column="DESCRIPTION_CZ" />
> >                         <result property="descriptionSk" column="DESCRIPTION_SK" />
> >                         <result property="descriptionEn" column="DESCRIPTION_EN" />
> >                         <result property="timestamp" column="TIMESTAMP" />
> >                         <result property="userId" column="USER_ID" />
> >                 </collection>
> >         </resultMap>
>
> > This mapping is for the statement declaration as written in Your
> > answer.
> > What else should I do?
>
> > On 3 zář, 17:24, Poitras Christian <[hidden email]>
> > wrote:
>
> > > I don't have an example, but make sure that theOUTparameters in your mapper are beans and not final parameters like int or String.
>
> > > This should work:
> > > Public void procedureCall (@Param("sexId") String sexId, @Param("outParameters") Map<String, Object> outParameters);
>
> > > <select id="procedureCall" statementType="CALLABLE">
> > >                 {call
> > >                 ODS_APPL_PKG.inq_lov_sex(
> > >                 #{sexId,jdbcType=VARCHAR,mode=IN},
> > >                 #{outParameters.rcuOut,mode=OUT,jdbcType=CURSOR},
> > >                 #{outParameters.resultCode,mode=OUT,jdbcType=VARCHAR},
> > >                 #{outParameters.errorCode,mode=OUT,jdbcType=VARCHAR},
> > >                 #{outParameters.errorDesc,mode=OUT,jdbcType=VARCHAR})}
> > > </select>
>
> > > You will also need to convert the CURSOR into some actual object. You could use resultMap.
> > > #{outParameters.rcuOut,mode=OUT,jdbcType=CURSOR,resultMap=my_map},
>
> > > -----Message d'origine-----
> > > De : [hidden email] [mailto:[hidden email]] De la part de Jan Žanda
> > > Envoyé : September-03-10 11:00 AM
> > > À : mybatis-user
> > > Objet : MyBatis and OracleStoredProcedures with multiple output variables
>
> > > Hi guys,
>
> > > Can you please explain to me, how MyBatis works when you call a
> > >procedurewith multiple output variables?
>
> > > I haveprocedurelike this:
>
> > >  PROCEDUREinq_lov_sex(p_sex_id    IN
> > > profile_lov_client_sex.client_sex_id%TYPE,
> > >                         rcu_out    OUTrcu_lov_sex,
> > >                         result_codeOUTVARCHAR2,
> > >                         error_code  OUTVARCHAR2,
> > >                         error_desc  OUTVARCHAR2)
>
> > > and I canot findout, how to map it correctly. In mapper, I use this:
>
> > > <select id="procedureCall" statementType="CALLABLE">
> > >                 {call
> > >                 ODS_APPL_PKG.inq_lov_sex(
> > >                 #{sexId,jdbcType=VARCHAR,mode=IN},
> > >                 #{rcuOut,mode=OUT,jdbcType=CURSOR},
> > >                 #{resultCode,mode=OUT,jdbcType=VARCHAR},
> > >                 #{errorCode,mode=OUT,jdbcType=VARCHAR},
> > >                 #{errorDesc,mode=OUT,jdbcType=VARCHAR})}
> > > </select>
>
> > > I was trying few hours to map it somehow, but no result.
> > > Could you please anyone post an example, how to correctly handle these
> > > situations? There is absolutely nothing in the documentation about
> > >storedprocedures.