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 java cracked <ak...@gmail.com> on 2008/01/21 09:01:47 UTC

calling Stored Functions thru Ibatis

hi,

Can any one tell me how to call Oracle Stored Functions in IBatis. Stored
Function has DML statements.


thanks & Regards

-- 
View this message in context: http://www.nabble.com/calling-Stored-Functions-thru-Ibatis-tp14992691p14992691.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


RE: calling Stored Functions thru Ibatis

Posted by b das <ak...@gmail.com>.
Thanks for quick help, 

Can u provide me the Stored Functions ( return result upon execution).



BEHL, Manish, IDC wrote:
> 
> Hi,
>     Below mentioned is the simple example to use procedure from iBatis
> 
> 
> <parameterMap id="swapParameters" class="map" >
>     <parameter property="contactId" jdbcType="INTEGER"
>         javaType="java.lang.Integer" mode="IN"/>
>     <parameter property="firstName" jdbcType="VARCHAR"
>         javaType="java.lang.String" mode="IN"/>
>     <parameter property="lastName" jdbcType="VARCHAR"
>         javaType="java.lang.String" mode="IN"/>
> </parameterMap>
> 
> <procedure id="swapContactName" parameterMap="swapParameters" >
> {call swap_contact_name (?, ?,?)}
> </procedure>
> 
> 
> Inside of your Java code first, create a HashMap of parameters that you
> want to pass to the procedure, and then pass it to sqlMap along with name
> of the query that you want to execute.
> 
> 
> HashMap paramMap = new HashMap();
> paramMap.put("contactId", new Integer(1));
> paramMap.put("firstName", "Sunil");
> paramMap.put("lastName", "Patil");
> sqlMap.queryForObject("swapContactName", paramMap);
> 
> 
> 
> Regards
> 
> Manish Behl
> RBS India Development Centre (P) Ltd
> 
> T  +91 124 433 6150
> F  +91 124 433 6500
> manish.behl@rbs.com
> Unitech Business Park, Block F, Sector 41, South City 1,
> Gurgaon - 122001, Haryana, Delhi, India
> 
> P Please don't print this e-mail unless you really need to.
> www.rbs.com
> 
> 
> -----Original Message-----
> From: java cracked [mailto:akbdas@gmail.com]
> Sent: 21 January 2008 13:32
> To: user-java@ibatis.apache.org
> Subject: calling Stored Functions thru Ibatis
> 
> 
> hi,
> 
> Can any one tell me how to call Oracle Stored Functions in IBatis. Stored
> Function has DML statements.
> 
> 
> thanks & Regards
> 
> --
> View this message in context:
> http://www.nabble.com/calling-Stored-Functions-thru-Ibatis-tp14992691p14992691.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> 
> ***********************************************************************************
> The Royal Bank of Scotland plc. Registered in Scotland No 90312.
> Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
> Authorised and regulated by the Financial Services Authority 
>  
> This e-mail message is confidential and for use by the 
> addressee only. If the message is received by anyone other 
> than the addressee, please return the message to the sender 
> by replying to it and then delete the message from your 
> computer. Internet e-mails are not necessarily secure. The 
> Royal Bank of Scotland plc does not accept responsibility for 
> changes made to this message after it was sent. 
> 
> Whilst all reasonable care has been taken to avoid the 
> transmission of viruses, it is the responsibility of the recipient to 
> ensure that the onward transmission, opening or use of this 
> message and any attachments will not adversely affect its 
> systems or data. No responsibility is accepted by The 
> Royal Bank of Scotland plc in this regard and the recipient should carry 
> out such virus and other checks as it considers appropriate. 
> Visit our websites at: 
> www.rbs.com
> www.rbs.com/gbm
> www.rbsgc.com
> ***********************************************************************************
> 
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email 
> ______________________________________________________________________
> 
> 

-- 
View this message in context: http://www.nabble.com/calling-Stored-Functions-thru-Ibatis-tp14992691p14993900.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


RE: calling Stored Functions thru Ibatis

Posted by "BEHL, Manish, IDC" <Ma...@rbs.com>.
Hi,
    Below mentioned is the simple example to use procedure from iBatis


<parameterMap id="swapParameters" class="map" >
    <parameter property="contactId" jdbcType="INTEGER"
        javaType="java.lang.Integer" mode="IN"/>
    <parameter property="firstName" jdbcType="VARCHAR"
        javaType="java.lang.String" mode="IN"/>
    <parameter property="lastName" jdbcType="VARCHAR"
        javaType="java.lang.String" mode="IN"/>
</parameterMap>

<procedure id="swapContactName" parameterMap="swapParameters" >
{call swap_contact_name (?, ?,?)}
</procedure>


Inside of your Java code first, create a HashMap of parameters that you want to pass to the procedure, and then pass it to sqlMap along with name of the query that you want to execute.


HashMap paramMap = new HashMap();
paramMap.put("contactId", new Integer(1));
paramMap.put("firstName", "Sunil");
paramMap.put("lastName", "Patil");
sqlMap.queryForObject("swapContactName", paramMap);



Regards

Manish Behl
RBS India Development Centre (P) Ltd

T  +91 124 433 6150
F  +91 124 433 6500
manish.behl@rbs.com
Unitech Business Park, Block F, Sector 41, South City 1,
Gurgaon - 122001, Haryana, Delhi, India

P Please don't print this e-mail unless you really need to.
www.rbs.com


-----Original Message-----
From: java cracked [mailto:akbdas@gmail.com]
Sent: 21 January 2008 13:32
To: user-java@ibatis.apache.org
Subject: calling Stored Functions thru Ibatis


hi,

Can any one tell me how to call Oracle Stored Functions in IBatis. Stored Function has DML statements.


thanks & Regards

--
View this message in context: http://www.nabble.com/calling-Stored-Functions-thru-Ibatis-tp14992691p14992691.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

***********************************************************************************
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 
 
This e-mail message is confidential and for use by the 
addressee only. If the message is received by anyone other 
than the addressee, please return the message to the sender 
by replying to it and then delete the message from your 
computer. Internet e-mails are not necessarily secure. The 
Royal Bank of Scotland plc does not accept responsibility for 
changes made to this message after it was sent. 

Whilst all reasonable care has been taken to avoid the 
transmission of viruses, it is the responsibility of the recipient to 
ensure that the onward transmission, opening or use of this 
message and any attachments will not adversely affect its 
systems or data. No responsibility is accepted by The 
Royal Bank of Scotland plc in this regard and the recipient should carry 
out such virus and other checks as it considers appropriate. 
Visit our websites at: 
www.rbs.com
www.rbs.com/gbm
www.rbsgc.com
***********************************************************************************

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________