原因

Template

在使用中 sql语句创建,statement对象创建 赋值等等 每次都要重新写

Template

select语句查询完显示结果也需要手动写输出    这样操作起来非常复杂

 

Spring 对JDBC 的简单封装-------Template  

步骤

    1.导入jar包

     2.创建jdbcTemplate对象 依赖于数据源datasource 

          JdbcTemplate template =new JdbcTempLate(ds);

     3,调用JdbcTemplate方法 

                  Template

          

  展示

Template

Template

Template

BeanPropertyRowMapper类的实现类似于

Template

 

Template

 

相关文章: