I'm using Spring JDBCTemplate to connect to the SQL Server.
I have a list of Objects that needed to be inserted into a table of SQL Server.
What I did is the following:
public void batchInsert(final List<Bean> list) {
    final String sql = "insert into temp"
            + "(id, name, amount, location, time, price) "
            + " values (?, ?, ?, ?, ?, ?)";
    getJdbcTemplate().batchUpdate(sql, new BatchPreparedStatementSetter() {
        @Override
        public void setValues(PreparedStatement ps, int i) throws SQLException {
            Bean vo = list.get(i);
            ps.setString(1, vo.getId());
            ps.setString(2, vo.getName());
            ps.setDouble(3, vo.getAmount());
            ps.setString(4, vo.getLocation());
            ps.setString(5, vo.getTime());
            ps.setDouble(6, vo.getPrice());
        }
        @Override
        public int getBatchSize() {
            return list.size();
        }
    });
}
But now, I'd like to pass the parameter List<Bean> list to a stored procedure which handle the batch insert as high efficient as possible.
May I ask how to implement this?
 
     
     
     
     
     
    