Beispiel #1
0
 private void insertFootBaller(FootBaller footBaller) {
   try {
     String stmtInsert = String.format(STATEMENT_INSERT, "footballers", "?,?");
     PreparedStatement stmt = prepareStatement(stmtInsert);
     stmt.setLong(1, footBaller.getId());
     stmt.setString(2, footBaller.getClub());
     stmt.executeUpdate();
   } catch (SQLException e) {
     throw new AppRuntimeException(e);
   }
 }
Beispiel #2
0
 private void updateFootBaller(FootBaller footBaller) {
   try {
     String stmtUpdate = String.format(STATEMENT_UPDATE, "footballers", "club=?");
     PreparedStatement stmt = prepareStatement(stmtUpdate);
     stmt.setString(1, footBaller.getClub());
     stmt.setLong(2, footBaller.getId());
     stmt.executeUpdate();
   } catch (SQLException e) {
     throw new AppRuntimeException(e);
   }
 }