1: org.apache.ibatis.mapping.ParameterMapping
為Mybatis參數的抽象表示,包括Java類型與數據庫類型以及類型處理器屬性名字等等!!
例如:
其中id真是參數類型為Long,在mybatis中統一使用Object表示!
2:org.apache.ibatis.mapping.BoundSql 是XML中配置的某一個方法的SQL的抽象表示,而MappedStatement則是整個Mapper.xml的抽象表示!!!!
該類封裝了SQL以及參數信息,其中 parameterObject成員是一個Map數據結構,key/value為參數名字,例如:
MappedStatement是整個Mapper.xml的抽象表示:
3:org.apache.ibatis.executor.statement.StatementHandler 負責設置SQL中的參數的類 ,在具體子類中完成操作!
其中org.apache.ibatis.executor.statement.PreparedStatementHandler#parameterize方法負責參數的填充,StatementHandler持有一個ParameterHandler成員,底層實現使用的是org.apache.ibatis.executor.parameter.ParameterHandler工具類完成到Statement參數的填充!!!!
4:org.apache.ibatis.executor.parameter.ParameterHandler 一個參數Handler設置所有的參數到PreparedStatement中!!!源碼說明:
/** * A parameter handler sets the parameters of the {@code PreparedStatement} * * @author Clinton Begin */ public interface ParameterHandler { Object getParameterObject(); void setParameters(PreparedStatement ps) throws SQLException; }