实践Spring JDBC

Spring JDBC是Spring对数据库访问的初级封装

*Template

1
JdbcOperations

JdbcTemplate

JdbcTemplate主要包含如下方法:

  1. execute():一般用于执行DDL
  2. update() and batchUpdate(),一般用于执行新增、删除和修改数据
  3. query() and queryFor*(),一般用于执行查询数据
  4. call(),一般用于执行存储过程和函数

KeyHolder

RowMapper

ResultSetExtractor

PreparedStatementSetter

PreparedStatementCreator

RowCallbackHandler

1
delete from BookInfo where bid =?

NamedParameterJdbcTemplate

基于JdbcTempate封装从而支持命名参数特性

SqlParameterSource

1
2
3
delete from mb_mcht_info t where t.mcht_name = :mchtName
update mb_mcht_info t set t.mcht_address = :mchtAddress where t.mcht_name = :mchtName
select t.* from mb_mcht_info t where t.mcht_name = :mchtName

*DaoSupport

JdbcDaoSupport

NamedParameterJdbcDaoSupport

1

异常体系

声明式事物