Spring database
Templating data access
Spring的DAO蕴含一个设计模式:模板方法 Template Method pattern
Spring separates the fixed and variable parts of the data access process into two dis-
tinct classes: templates and callbacks. Templates manage the fixed part of the process,
whereas your custom data access code is handled in the callbacks. Figure 5.2 shows the
responsibilities of both of these classes.
public interface SqlMapClientCallback<T> {
T doInSqlMapClient(SqlMapExecutor executor) throws SQLException;
}
其中真正执行的是SqlMapExecutor:这里为SqlMapClient
spring提供的Templates如下:
spring的DAO UML图如下:
待完成。。。