All pastes #182311 Raw Edit

Anonymous

public text v1 · immutable
#182311 ·published 2006-09-25 22:25 UTC
rendered paste body
  <statement id="insertPerfTagData">
    insert into perf_tag (perf_id, tag_id, perf_mac_addr, sensor_id, sensor_type, poll_interval, board_slot)
    values(#perfId#, #tagId#, #perfMacAddr#, #sensorId#, #sensorType#, #pollInterval#, #boardSlot#);
  </statement>


  public int insertList(String statementName, Object parameterObject) throws DaoException {
    int result = 0;
    ArrayList list = (ArrayList) parameterObject;
    try {
      sqlMap.startBatch();
      for(int i=0; i<list.size(); i++) {
        //result = sqlMap.insert(statementName, (Object) list.get(i));
        result = sqlMap.update(statementName, (Object) list.get(i));
      }
      sqlMap.executeBatch();
    } catch (SQLException e) {
      try {
        sqlMap.endTransaction();
      } catch (SQLException ex) {
        throw new DaoException(ex.fillInStackTrace());
      }
      throw new DaoException(e.fillInStackTrace());
    }
    return result;
  }