public JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());
String sql = "select * from emp";
List<Emp> list = template.query(sql, new BeanPropertyRowMapper<Emp>(Emp.class));
for (Emp emp : list) {
System.out.println(emp);
}
使用JdbcTemplate将查询结果直接封装进对象
最新推荐文章于 2024-06-27 08:00:00 发布