예제 #1
0
  public void deleteServicePrice(ServicePrice servicePrice) {
    try {
      PreparedStatement preparedStatement =
          getConnection()
              .prepareStatement(
                  "DELETE FROM  \"service_price\" where \"service_id\" = ? AND \"date\" = ?");
      preparedStatement.setInt(1, servicePrice.getServiceId());
      preparedStatement.setDate(2, Date.valueOf(servicePrice.getDate()));
      preparedStatement.executeUpdate();

    } catch (SQLException ex) {
      ex.printStackTrace();
      throw new DAOException();
    }
  }
예제 #2
0
  public void saveServicePrice(ServicePrice servicePrice) {
    try {
      PreparedStatement preparedStatement =
          getConnection()
              .prepareStatement(
                  "INSERT INTO \"service_price\" (\"service_id\", \"date\", \"price\") VALUES(?, ?, ?)");
      preparedStatement.setInt(1, servicePrice.getServiceId());
      preparedStatement.setDate(2, Date.valueOf(servicePrice.getDate()));
      preparedStatement.setBigDecimal(3, servicePrice.getPrice());
      preparedStatement.executeUpdate();

    } catch (SQLException ex) {
      ex.printStackTrace();
      throw new DAOException();
    }
  }