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.

 

扫描二维码关注公众号,回复: 732460 查看本文章


 

public interface SqlMapClientCallback<T> {
	T doInSqlMapClient(SqlMapExecutor executor) throws SQLException;
}

其中真正执行的是SqlMapExecutor:这里为SqlMapClient

 
 

spring提供的Templates如下:

 

spring的DAO UML图如下:

 


 待完成。。。

猜你喜欢

转载自cxmqq333.iteye.com/blog/1873208