自力更生,在线文档一大堆!
参考spring 2.5文档 (
11.2. 利用JDBC核心类控制JDBC的基本操作和错误处理
11.2.1. JdbcTemplate类 这里面几个看看就会了)
11.2.1.2. JdbcTemplate 的最佳实践
Dao层:
public class JdbcCorporateEventDao implements CorporateEventDao {
private JdbcTemplate jdbcTemplate;
public void setDataSource(DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
// JDBC-backed implementations of the methods on the CorporateEventDao follow...
}
xml配置文件
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">