Пример #1
0
 public ArrayList<String> getAllEhvssNamesWithId() {
   ArrayList<EHVSS> ehvssRecords = getAll();
   ArrayList<String> ehvssNames = new ArrayList<String>();
   for (EHVSS ehvss : ehvssRecords) {
     ehvssNames.add(ehvss.getName() + "(ID:" + ehvss.getId() + ")");
   }
   return ehvssNames;
 }
Пример #2
0
  public EHVSS updateEHVSS(EHVSS ehvss) {
    try {
      Connection connection = DatabaseConnection.getConnection("mms_new");
      PreparedStatement ps =
          connection.prepareStatement(
              "update EHVSS set code=?,name=?,location=?,region=?,circle=?,division=? where id=?");
      ps.setString(1, ehvss.getCode());
      ps.setString(2, ehvss.getName());
      ps.setString(3, "DUMMY");
      ps.setString(4, ehvss.getRegion());
      ps.setString(5, "DUMMY");
      ps.setString(6, "DUMMY");
      ps.setInt(7, Integer.parseInt(ehvss.getId()));
      ps.executeUpdate();
      ps.close();

    } catch (SQLException e) {
      System.out.println("Exception in [updateEHVSS(EHVSS)]" + e);
    }
    return ehvss;
  }