JdbcTemplate 主要提供以下五类方法: execute 方法:可以用于执行任何SQL 语句,一般用于执行DDL 语句; update 方法及batchUpdate 方法:u pdate 方法用于执行新增、修改、删除等语句;batchUpdate 方法用于执行批处理相关语句; query 方法及queryForXXX 方法:用于执行查询相关语句; call 方法:用于执行存储过程、函数相关语句
JdbcTemplate 类支持的回调类: 预编译语句及存储过程创建回调:用于根据 JdbcTemplate 提供的连接创建相应的语句; PreparedStatementCreator:通过回调获取 JdbcTemplate 提供的 Connection,由用户使用该 Conncetion 创建相关的 PreparedStatement; CallableStatementCreator:通过回调获取 JdbcTemplate 提供的 Connection,由用户使用该 Conncetion 创建相关的 CallableStatement; 预编译语句设值回调:用于给预编译语句相应参数设值; PreparedStatementSetter:通过回调获取 JdbcTemplate 提供的PreparedStatement,由用户来对相应的预编译语句相应参数设值; BatchPreparedStatementSetter:;类似于PreparedStatementSetter,但用于批处理,需要指定批处理大小; 自定义功能回调:提供给用户一个扩展点,用户可以在指定类型的扩展点执行任何数量需要的操作; ConnectionCallback:通过回调获取 JdbcTemplate 提供的 Connection,用户可在该 Connection 执行任何