关键接口和类,我们以经典的2.X版本来介绍,ibatis整体的设计还是非常清晰,明了的。
public interface Nodelet { 节点接口
public class NodeletParser { 节点解析类
public interface TypeHandler { 类型操作接口
public abstract class BaseTypeHandler implements TypeHandler {
public class TypeHandlerFactory { 类型操作工厂
public interface DataExchange { 数据交互接口,用来在参数映射/结果映射和关联对象之间的交换
public class DataExchangeFactory { 数据交换工厂
public class SqlMapParser { sql映射解析
public class SqlMapConfigParser { sql映射配置解析
public interface SqlMapExecutor { sql映射执行接口
public interface SqlMapTransactionManager { sql映射事务管理接口
public interface SqlMapClient extends SqlMapExecutor, SqlMapTransactionManager { sql映射客户操作接口
public class SqlMapClientImpl implements SqlMapClient, ExtendedSqlMapClient { sql映射客户操作实现类
public class SqlMapClientBuilder { sql映射客户操作
public interface SqlMapSession extends SqlMapExecutor, SqlMapTransactionManager { sql映射会话接口
public class SqlMapSessionImpl implements SqlMapSession { // 会实例化一个SessionScope
public class SqlMapExecutorDelegate { sql映射执行代理
public class SessionScope { 会话范围
public class StatementScope { 声明范围
public class MappedStatement { 映射声明类,真正的执行sql的类
public int executeUpdate(StatementScope statementScope, Transaction trans, Object parameterObject)
public Object executeQueryForObject(StatementScope statementScope, Transaction trans, Object parameterObject, Object resultObject)
public List executeQueryForList(StatementScope statementScope, Transaction trans, Object parameterObject, int skipResults, int maxResults)
}
public interface Transaction { 事物接口
public class JdbcTransaction implements Transaction { jdbc事务
public class TransactionManager { 事务管理
public interface TransactionConfig { 事务配置接口
public abstract class BaseTransactionConfig implements TransactionConfig { 基本的事务配置类
public class JdbcTransactionConfig extends BaseTransactionConfig { jdbc事务配置类
public interface RowHandler { 行操作接口
public class DefaultRowHandler implements RowHandler { 默认的行操作类
public class RowHandlerCallback { 行操作回调类
public class SqlExecutor { sql执行类
public void executeQuery(StatementScope statementScope, Connection conn, String sql, Object[] parameters, int skipResults, int maxResults, RowHandlerCallback callback) throws SQLException {
private void handleResults(StatementScope statementScope, ResultSet rs, int skipResults, int maxResults, RowHandlerCallback callback) throws SQLException {
private void handleResults(StatementScope statementScope, ResultSet rs, int skipResults, int maxResults, RowHandlerCallback callback) throws SQLException {
}
...
}
public class ParameterMap { 参数映射
public class ResultMap { 结果映射