关于jdbcTemplate.queryForObject查询对象的问题public class GoodsCategory implements java.io.Serializable {
private String id;
private String name;
private GoodsCategory parent;
private Set<GoodsCategory> children = new HashSet<GoodsCategory>(0);我是通过一下方法查询商品分类对象的,
GoodsCategory model = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<GoodsCategory>(GoodsCategory.class), id);
要怎么同时读取里面的parent对象

解决方案 »

  1.   

    可以啊,但是需要我们自己去封装,实现BatchPreparedStatementSetter接口的方法即可
    例如:super.getJdbcTemplate().batchUpdate(sql, new BatchPreparedStatementSetter() {
    @Override
    public void setValues(PreparedStatement ps, int i) throws SQLException {
    ps.setString(1, album.getFaName());
    ps.setString(2, album.getFaDescription());
    ps.setLong(3, (long)1);
    ps.setLong(4, album.getFaLimit());
    }

    @Override
    public int getBatchSize() {  //执行多少次
    return 1;
    }
    });