@Override public PaybackConfirmation save(AccountIncome income, Purchase purchase) { String sql = "insert into PAYBACK (NUMBER, AMOUNT, DATE, ACCOUNT_NUMBER, MERCHANT_NUMBER, TRANSACTION_AMOUNT, TRANSACTION_DATE) " + "values (?, ?, ?, ?, ?, ?, ?)"; try (Connection connection = dataSource.getConnection(); PreparedStatement statement = connection.prepareStatement(sql)) { String number = nextConfirmationNumber(connection); statement.setString(1, number); statement.setBigDecimal(2, income.getAmount().getAmount()); statement.setDate(3, new Date(now().toDate().getTime())); statement.setString(4, income.getAccountNumber()); statement.setString(5, purchase.getMerchantNumber()); statement.setBigDecimal(6, purchase.getAmount().getAmount()); statement.setDate(7, new Date(purchase.getDate().toDate().getTime())); return new PaybackConfirmation(number, income); } catch (SQLException e) { throw new RuntimeException("Error in save!", e); } }
@Override public PaybackConfirmation save(AccountIncome income, Purchase purchase) { String sql = "insert into PAYBACK (NUMBER, AMOUNT, DATE, ACCOUNT_NUMBER, MERCHANT_NUMBER, TRANSACTION_AMOUNT, TRANSACTION_DATE) " + "values (?, ?, ?, ?, ?, ?, ?)"; try (Connection connection = dataSource.getConnection(); PreparedStatement statement = connection.prepareStatement(sql)) { String number = nextConfirmationNumber(connection); statement.setString(1, number); statement.setBigDecimal(2, income.getAmount().getAmount()); statement.setDate(3, new Date(now().toDate().getTime())); statement.setString(4, income.getAccountNumber()); statement.setString(5, purchase.getMerchantNumber()); statement.setBigDecimal(6, purchase.getAmount().getAmount()); statement.setDate(7, new Date(purchase.getDate().toDate().getTime())); return new PaybackConfirmation(number, income); } catch (SQLException e) { throw new RuntimeException("Error in save!", e); } }
@Override public PaybackConfirmation save(AccountIncome income, Purchase purchase) { String sql = "insert into PAYBACK (NUMBER, AMOUNT, DATE, ACCOUNT_NUMBER, MERCHANT_NUMBER, TRANSACTION_AMOUNT, TRANSACTION_DATE) " + "values (?, ?, ?, ?, ?, ?, ?)"; try (Connection connection = dataSource.getConnection(); PreparedStatement statement = connection.prepareStatement(sql)) { String number = nextConfirmationNumber(connection); statement.setString(1, number); statement.setBigDecimal(2, income.getAmount().getAmount()); statement.setDate(3, new Date(now().toDate().getTime())); statement.setString(4, income.getAccountNumber()); statement.setString(5, purchase.getMerchantNumber()); statement.setBigDecimal(6, purchase.getAmount().getAmount()); statement.setDate(7, new Date(purchase.getDate().toDate().getTime())); return new PaybackConfirmation(number, income); } catch (SQLException e) { throw new RuntimeException("Error in save!", e); } }
@Override public PaybackConfirmation save(AccountIncome income, Purchase purchase) { String sql = "insert into PAYBACK (NUMBER, AMOUNT, DATE, ACCOUNT_NUMBER, MERCHANT_NUMBER, TRANSACTION_AMOUNT, TRANSACTION_DATE) " + "values (?, ?, ?, ?, ?, ?, ?)"; try (Connection connection = dataSource.getConnection(); PreparedStatement statement = connection.prepareStatement(sql)) { String number = nextConfirmationNumber(connection); statement.setString(1, number); statement.setBigDecimal(2, income.getAmount().getAmount()); statement.setDate(3, new Date(now().toDate().getTime())); statement.setString(4, income.getAccountNumber()); statement.setString(5, purchase.getMerchantNumber()); statement.setBigDecimal(6, purchase.getAmount().getAmount()); statement.setDate(7, new Date(purchase.getDate().toDate().getTime())); return new PaybackConfirmation(number, income); } catch (SQLException e) { throw new RuntimeException("Error in save!", e); } }
@Override public PaybackConfirmation save(AccountIncome income, Purchase purchase) { String sql = "insert into PAYBACK (NUMBER, AMOUNT, DATE, ACCOUNT_NUMBER, MERCHANT_NUMBER, TRANSACTION_AMOUNT, TRANSACTION_DATE) " + "values (?, ?, ?, ?, ?, ?, ?)"; try (Connection connection = dataSource.getConnection(); PreparedStatement statement = connection.prepareStatement(sql)) { String number = nextConfirmationNumber(connection); statement.setString(1, number); statement.setBigDecimal(2, income.getAmount().getAmount()); statement.setDate(3, new Date(now().toDate().getTime())); statement.setString(4, income.getAccountNumber()); statement.setString(5, purchase.getMerchantNumber()); statement.setBigDecimal(6, purchase.getAmount().getAmount()); statement.setDate(7, new Date(purchase.getDate().toDate().getTime())); return new PaybackConfirmation(number, income); } catch (SQLException e) { throw new RuntimeException("Error in save!", e); } }
@Override public PaybackConfirmation save(AccountIncome income, Purchase purchase) { String sql = "insert into PAYBACK (NUMBER, AMOUNT, DATE, ACCOUNT_NUMBER, MERCHANT_NUMBER, TRANSACTION_AMOUNT, TRANSACTION_DATE) " + "values (?, ?, ?, ?, ?, ?, ?)"; String number = nextConfirmationNumber(); jdbcTemplate.update(sql, number, income.getAmount().getAmount(), new Date(now().toDate().getTime()), income.getAccountNumber(), purchase.getMerchantNumber(), purchase.getAmount().getAmount(), new Date(purchase.getDate().toDate().getTime())); return new PaybackConfirmation(number, income); }