http://www.iteye.com/topic/190083
在spring2.5以前时使用JdbcTemplate总会被RowMapper所烦恼,比如
private class JdbcPetRowMapper implements ParameterizedRowMapper<JdbcPet> {
public JdbcPet mapRow(ResultSet rs, int rownum) throws SQLException {
JdbcPet pet = new JdbcPet();
pet.setId(rs.getInt("id"));
pet.setName(rs.getString("name"));
pet.setBirthDate(rs.getDate("birth_date"));
pet.setTypeId(rs.getInt("type_id"));
pet.setOwnerId(rs.getInt("owner_id"));
return pet;
}
}
现在方便多了,变成这样:
this.simpleJdbcTemplate.queryForObject(
"SELECT id, first_name, last_name, address, city, telephone FROM owners WHERE id=?",
ParameterizedBeanPropertyRowMapper.newInstance(Owner.class),
id)
依靠反射漂亮的完成了前段中的bean set
分享到:
相关推荐
Spring中的JdbcTemplate,Spring中的的事务.。。。。。。。
spring-jdbcTemplate实例工程
strut2+spring+springjdbctemplate做的简易登录系统
使用Spring的JdbcTemplate实现分页功能
JdbcTemplate api 下载 Spring
一个非常简单基于注解的Spring JdbcTemplate,供初学者参考用。
spring mvc+jdbctemplate非注解例子包含aop 连接池等.使用的jar包需要spring2.5以上
NULL 博文链接:https://zhangyulong.iteye.com/blog/992578
springjdbc演示,spring持久层知识,包括注入数据源,jdbcTemplate操作数据库,jdbcTemplate以对象方式操作数据库
配制Spring事务和JdbcTemplate使用 配制Spring事务和JdbcTemplate使用
Spring JDBCTemplate连接池jar包
Spring-JdbcTemplate
Spring Security 3.1 +Spring +Servlet+JdbcTemplate 自己找的资料,并开发成功
模仿spring jdbcTemplate的粗略实现,只有很小的参考价值,如果是java初学者可以使用这个封装好的工具进行数据库操作,只需要在db.properties里配置好driver,url等信息
使用Spring的JdbcTemplate调用Oracle的存储过程
Spring JdbcTemplate的操作,包括接口,BaseDao,log4J配置文件,主要为oracle数据库操作,很多特殊方法只对oracle有效
Spring JdbcTemplate调用Oracle存储过程输出游标结果集实现增删改查
Spring框架中jdbcTemplate 的使用
自己做的一个小案例,spring 的ioc小案例,你也可以去以下链接看文章讲解https://blog.csdn.net/zyqblog/article/details/82590003
Spring框架JdbcTemplate类中查询方法介绍