首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

jdbcTemplate 调用存储过程跟回到函数

2013-10-25 
jdbcTemplate 调用存储过程和回到函数?2、jdbcTemplate查询数据 三种callback1)org.springframework.jdbc.c

jdbcTemplate 调用存储过程和回到函数

?2、jdbcTemplate查询数据 三种callback

1)org.springframework.jdbc.core.ResultSetExtractor:基本上属于JdbcTemplate内部使用的Callback接口,相对于下面两个Callback接口来说,ResultSetExtractor拥有更多的控制权,因为使用它,需要自行处理ResultSet。

public interface RowMapper {     Object mapRow(ResultSet rs, int rowNum) throws SQLException; } List customerList = jdbcTemplate.query("select * from customer", new RowMapper(){    public Object mapRow(ResultSet rs, int rowNumber) throws SQLException {       Customer customer = new Customer();       customer.setFirstName(rs.getString(1));       customer.setLastName(rs.getString(2));       ...       return customer;    }});

?

?

?

?

?

热点排行