コード例 #1
0
ファイル: PlayerMapper.java プロジェクト: elainenaomi/PofEAA
 private void insertCricketer(Cricketer cricketer) {
   try {
     String stmtInsert = String.format(STATEMENT_INSERT, "cricketers", "?,?");
     PreparedStatement stmt = prepareStatement(stmtInsert);
     stmt.setLong(1, cricketer.getId());
     stmt.setLong(2, cricketer.getBattingAverage());
     stmt.executeUpdate();
   } catch (SQLException e) {
     throw new AppRuntimeException(e);
   }
 }
コード例 #2
-2
ファイル: PlayerMapper.java プロジェクト: elainenaomi/PofEAA
 private void updateCricketer(Cricketer cricketer) {
   try {
     String stmtUpdate = String.format(STATEMENT_UPDATE, "cricketers", "batting_average=?");
     PreparedStatement stmt = prepareStatement(stmtUpdate);
     stmt.setLong(1, cricketer.getBattingAverage());
     stmt.setLong(2, cricketer.getId());
     stmt.executeUpdate();
   } catch (SQLException e) {
     throw new AppRuntimeException(e);
   }
 }