Pages

Showing posts with label iBatis. Show all posts
Showing posts with label iBatis. Show all posts

Tuesday, April 27, 2010

iBatis (MyBatis)

How to call stored procedure in iBatis?

You can execute stored procedure via SqlMap xml file.
See the folloing example:

<!-- To call stored procedure. -->
<procedure id="getItemInfo" resultClass="Items" parameterMap="getItemInfoCall">
{ call getEmp( #invoiceNo# ) }
</procedure>


<parameterMap id="getItemInfoCall" class="map">
<parameter property="invoiceNo" jdbcType="INT" javaType="java.lang.Integer" mode="IN"/>

</parameterMap>

<!-- Now call this method -->

Reader rd = Resources.getResourceAsReader("SqlMapConfig.xml");

SqlMapClient smclient = SqlMapClientBuilder.buildSqlMapClient(rd);

int invoiceNo = 1;

System.out.println("Getting item information from db");

Items itm = (Items)smclient .queryForObject ("Items.getItemInfo", invoiceNo);






- Steps to generate doa, mapping files and pojos using iBator


- iBatis and Oracle selectByExamplePaginatedList
Google
 

Java-Struts