コード例 #1
0
  public void deleteCallReport(Transaction transaction, CallReportDto cr) throws IOException {
    // TODO: STUB CODE, MUST MODIFY, DELETE THIS LINE WHEN DONE
    PreparedStatement prepareStatement = null;
    ResultSet resultSet = null;

    try {
      Connection connection = transaction.getResource(Connection.class);
      prepareStatement = connection.prepareStatement(DELETE_CALL_REPORT);
      prepareStatement.setInt(1, cr.getSeq());
      resultSet = prepareStatement.executeQuery();

    } catch (SQLException e) {
      throw new IOException(e);
    } finally {
      if (resultSet != null) {
        try {
          resultSet.close();
        } catch (SQLException e) {
          logger.warn(e.getMessage(), e);
        }
      }
      if (prepareStatement != null) {
        try {
          prepareStatement.close();
        } catch (SQLException e) {
          logger.warn(e.getMessage(), e);
        }
      }
    }
  }
コード例 #2
0
  public void updateCallReport(Transaction transaction, CallReportDto report) throws IOException {
    // TODO: STUB CODE, MUST MODIFY, DELETE THIS LINE WHEN DONE
    PreparedStatement prepareStatement = null;
    ResultSet resultSet = null;

    try {
      Connection connection = transaction.getResource(Connection.class);
      prepareStatement = connection.prepareStatement(UPDATE_CALL_REPORT);
      prepareStatement.setInt(1, report.getContact().getSeq());
      prepareStatement.setTimestamp(2, new java.sql.Timestamp(report.getCallTime().getTime()));
      prepareStatement.setString(3, report.getDetail());
      prepareStatement.setString(4, report.getRating());
      prepareStatement.setString(5, report.getSalesperson().getId());
      prepareStatement.setInt(6, report.getCallBack());
      prepareStatement.setInt(7, report.getActId());
      prepareStatement.setInt(8, report.getSeq());

      resultSet = prepareStatement.executeQuery();

    } catch (SQLException e) {
      throw new IOException(e);
    } finally {
      if (resultSet != null) {
        try {
          resultSet.close();
        } catch (SQLException e) {
          logger.warn(e.getMessage(), e);
        }
      }
      if (prepareStatement != null) {
        try {
          prepareStatement.close();
        } catch (SQLException e) {
          logger.warn(e.getMessage(), e);
        }
      }
    }
  }