jdbcTemplate的使用,RowMapper实现类:BeanPropertyRowMapper和SingleColumnRowMapper
RowMapper匿名类使用
这里直接一个个设置返回实体类的属性
public Student getStudentByName(String name) {
String sql = "select id,name from student where name = ?";
Student student = this.jdbcTemplate.queryForObject(sql, new Object[]{name}, new RowMapper<Student
原创
2022-03-18 14:48:29 ·
6503 阅读 ·
0 评论