Friday, June 27, 2008

iBATIS

Framework - Some of the common things found in all j2ee frameworks like iBATIS, spring, struts and others are
a. Builtin Classes
b. Configuration Files

iBATIS is Persistance layer framework which has Data Mapping


iBATIS supports inline SQL statements, dynamic SQL statements, ORM (Object Relational Framework). Even HIBERNATE is an ORM framework.

In HIBERBATE, Java Class and Database Table Mapping is done.

iBATIS supports SQL. We can write pseudo SQL statements in sql-map-config.xml

** iBATIS supports Aggregation with the help of ResultMap

For E.g

Class UserDetails{

String address;
String contact
}


Class User
{
String userId;
String passwd;
UserDetails userDetails;

}

Insertions,Updations of User Object is handled in a normal way.

For Retrieving User
UserDetails.xml would contain normal

For User.xml





LazyLoading Feature in iBATIS

Suppose if there are 1000 Master records and 1000 Detail records for each Master AND say we need to display a Detail Record on selection of given Master Record...

By implementing Lazy Loading DetailsRecord is fetched only once Master Record id selected.

RowHandler concept is similar to this.. What is the exact difference ?


Using #value# in<> for inline sql is sql injection PROOF.. where as $value is not



mainly 2 Types of Transactions

1. Flat Transaction - If there are 5 events in a transaction and one of them fails, all others are ROLLED BACK

2. Nested Transaction - If one of the 5 events fails, it is not ROLLED BACK. Here events are ordered in TREE fashion


Different Transaction Managers in iBATIS

1 JDBC - Transactions will be managed by JDBC

2 JTA - App Server Transaction Management details are used

3 EXTERNAL - Your Own Transaction Manager

No comments:

Post a Comment