Exemplo n.º 1
0
  public void deleteRentIds(Car car) {
    int count = 0;

    try {
      deleteRentById_sStmt.setInt(1, car.getId_samochod());

      count = deleteRentById_sStmt.executeUpdate();
    } catch (SQLException e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 2
0
  public List<Rent> getRentbyIds(Car car) {
    List<Rent> rents = new ArrayList<Rent>();

    try {

      getRentById_sStmt.setInt(1, car.getId_samochod());
      ResultSet rs = getRentById_sStmt.executeQuery();

      while (rs.next()) {
        Rent e = new Rent();
        e.setId_wypozyczenie(rs.getInt("id_wypozyczenie"));
        e.setIdreff_samochod(rs.getInt("idreff_samochod"));
        e.setIdreff_pracownik(rs.getInt("idreff_pracownik"));
        e.setData_wypozyczenia(rs.getString("data_wypozyczenia"));
        e.setIlosc_dni(rs.getInt("ilosc_dni"));
        e.setOplata(rs.getInt("oplata"));
        rents.add(e);
      }

    } catch (SQLException e) {
      e.printStackTrace();
    }
    return rents;
  }