When implemented using Java objects after SCA module modeling, the data persistence layer using Hibernate and IBATIS to implement SCA module is designed to provide SDO with data access services and accelerate the implementation of SCA modules. The previous article has talked about how to implement the data persistence layer of SCA module using Hibernate, we will introduce the IBATIS framework, compare the similarities and differences between IBATIS and Hibernate, and illustrate how to use IBATIS to implement SCA module Data persistence layer.
IBATIS is a data mapping framework whose SQL map provides the ability to significantly reduce the code that accesses relational databases. IBATIS's SQL map uses simple XML configuration files to map Java beans to SQL statements, compared to other database persistence layers and ORM frameworks such as JDO implementations, Hibernate, and so on, IBATIS SQL Map's greatest advantage is its simple Easy to learn, do not need to master the complex mapping relationship between the tables required in Hibernate. To use the IBATIS SQL Map, as long as you are familiar with Java bean,xml and SQL, you can give you the ability to fully exploit SQL statements.
The API provided by IBATIS SQL Map makes it easy for developers to map Java beans into PreparedStatement input parameters and ResultSet result sets. The idea of developing a SQL Map is simple: it provides a concise architecture that enables 80%JDBC functionality with 20% of the code.
IBATIS and Hibernate compared, on one word, that is iBATIS more direct, more natural.
The main content of this article is composed of two parts:
1. Introduce SCA module, import module project
2. Discuss how to introduce IBATIS to implement the persistence layer of SCA Module, and combine examples to discuss how to define IBATIS mapping files for various mapping relationships between classes and classes, and how to invoke IBATIS SQL Mapper API Operations JavaBean to implement logarithmic According to library object access.
The modeling and code implementations involved in this article were developed in IBM WebSphere Integration Developer v6.0 and tested on IBM WebSphere Process Server v6.0, using a database that is a memory database Hsql Db.
Note: The methods and practices described in this article are for personal research results and experience, not IBM's official recommended solution.
Prerequisite
Before you begin, you want to have the following basics:
Soa:service Oriented Architecture service-oriented architecture.
Sca:service Component Architecture Service Component Architecture
Sdo:service Data Object Service
IBATIS: An object-relational mapping solution in the Java language, the biggest feature is simple and easy to learn.
Import Sample Project
1. Sample Project Background Introduction
We still use the same example as the previous one to illustrate the whole process.
We use the following use case diagram to describe this scenario:
Figure-1: Use case diagram