新发现spring jdbc 2.5中有个BeanPropertyRowMapper,原来可以简单点,做记录和对象的映射,但前提
是你的POJO的属性跟记录集的声明是一样的,有点象APACHE的beanutils:
public List<Customer> getAll() {
return getJdbcTemplate().query("select * from test", new BeanPropertyRowMapper(Test.class));
}
博客园 © 2004-2025 浙公网安备 33010602011771号 浙ICP备2021040463号-3