You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Arpon <th...@mail.inet.hr> on 2010/03/24 11:03:42 UTC

IBatis 3.0 beta 10 + annotations + stored procedures

Does anyone have an example of calling stored procedures with IN and OUT
parameters without IBatis Map files (by using Annotations).
Sending parameter to procedure works well, but can't return parameter...

I am using IBatis3 beta 10... 

Interface:
@Select(" ibatis3select(#{Currency}) ") 
Integer selectACurrencyBatis3(String sCurrency );

Some DAO:
Integer ret = ((ACurrencyObjDuro) pomDuro).selectACurrencyBatis3(sCurrency);

Cheers,
Arpon
-- 
View this message in context: http://old.nabble.com/IBatis-3.0-beta-10-%2B-annotations-%2B-stored-procedures-tp28012821p28012821.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: IBatis 3.0 beta 10 + annotations + stored procedures

Posted by Arpon <th...@mail.inet.hr>.
Thanks, the answers were very helpful! =)



Oh.... I didn't even notice, but your parameter is a String, which is
immutable.  You'd have to pass the parameter in as a Map or a POJO. Since
Java doesn't support pass by reference, or out parameters, or mutable
strings, there's no way around this.

Clinton

On Wed, Mar 24, 2010 at 9:15 PM, Clinton Begin
<cl...@gmail.com>wrote:

> You have to tell iBATIS that it's a proc, and set the statement type to
> CALLABLE and set the parameter to an output parameter, as follows:
>
> @Select(" ibatis3select(#{Currency*,mode=OUT*}) ")
> *@Options(statementType = StatementType.CALLABLE)*
> Integer selectACurrencyBatis3(String sCurrency );
>
> Most procs will probably run without it, but for any proc specific
> variables, like out parameters, you have to do this.
>
> Clinton
-- 
View this message in context: http://old.nabble.com/IBatis-3.0-beta-10-%2B-annotations-%2B-stored-procedures-tp28012821p28024741.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: IBatis 3.0 beta 10 + annotations + stored procedures

Posted by Clinton Begin <cl...@gmail.com>.
Oh.... I didn't even notice, but your parameter is a String, which is
immutable.  You'd have to pass the parameter in as a Map or a POJO. Since
Java doesn't support pass by reference, or out parameters, or mutable
strings, there's no way around this.

Clinton

On Wed, Mar 24, 2010 at 9:15 PM, Clinton Begin <cl...@gmail.com>wrote:

> You have to tell iBATIS that it's a proc, and set the statement type to
> CALLABLE and set the parameter to an output parameter, as follows:
>
> @Select(" ibatis3select(#{Currency*,mode=OUT*}) ")
> *@Options(statementType = StatementType.CALLABLE)*
> Integer selectACurrencyBatis3(String sCurrency );
>
> Most procs will probably run without it, but for any proc specific
> variables, like out parameters, you have to do this.
>
> Clinton
>
>
>
> On Wed, Mar 24, 2010 at 4:03 AM, Arpon <th...@mail.inet.hr>wrote:
>
>>
>> Does anyone have an example of calling stored procedures with IN and OUT
>> parameters without IBatis Map files (by using Annotations).
>> Sending parameter to procedure works well, but can't return parameter...
>>
>> I am using IBatis3 beta 10...
>>
>> Interface:
>> @Select(" ibatis3select(#{Currency}) ")
>> Integer selectACurrencyBatis3(String sCurrency );
>>
>> Some DAO:
>> Integer ret = ((ACurrencyObjDuro)
>> pomDuro).selectACurrencyBatis3(sCurrency);
>>
>> Cheers,
>> Arpon
>> --
>> View this message in context:
>> http://old.nabble.com/IBatis-3.0-beta-10-%2B-annotations-%2B-stored-procedures-tp28012821p28012821.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>>
>

Re: IBatis 3.0 beta 10 + annotations + stored procedures

Posted by Clinton Begin <cl...@gmail.com>.
You have to tell iBATIS that it's a proc, and set the statement type to
CALLABLE and set the parameter to an output parameter, as follows:

@Select(" ibatis3select(#{Currency*,mode=OUT*}) ")
*@Options(statementType = StatementType.CALLABLE)*
Integer selectACurrencyBatis3(String sCurrency );

Most procs will probably run without it, but for any proc specific
variables, like out parameters, you have to do this.

Clinton


On Wed, Mar 24, 2010 at 4:03 AM, Arpon <th...@mail.inet.hr> wrote:

>
> Does anyone have an example of calling stored procedures with IN and OUT
> parameters without IBatis Map files (by using Annotations).
> Sending parameter to procedure works well, but can't return parameter...
>
> I am using IBatis3 beta 10...
>
> Interface:
> @Select(" ibatis3select(#{Currency}) ")
> Integer selectACurrencyBatis3(String sCurrency );
>
> Some DAO:
> Integer ret = ((ACurrencyObjDuro)
> pomDuro).selectACurrencyBatis3(sCurrency);
>
> Cheers,
> Arpon
> --
> View this message in context:
> http://old.nabble.com/IBatis-3.0-beta-10-%2B-annotations-%2B-stored-procedures-tp28012821p28012821.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>