@Override public ArrayList<DriverPO> findAll() { // TODO Auto-generated method stub ArrayList<DriverPO> drivers = new ArrayList<DriverPO>(); DriverPO driver = null; ResultSet result = null; String sql = "SELECT*FROM driverpo;"; try { result = Helper.find(sql); while (result.next()) { driver = new DriverPO( result.getString("name"), Work.valueOf(result.getString("work")), result.getString("workNumber"), result.getString("workPlaceNumber"), result.getString("birthDate"), result.getString("idNumber"), result.getString("phoneNumber"), result.getString("address"), Sex.valueOf(result.getString("sex")), result.getInt("driverYear"), result.getInt("page")); drivers.add(driver); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return drivers; }
@Override public DriverPO find(String id) { // TODO Auto-generated method stub ResultSet result = null; String sql = "SELECT*FROM driverpo WHERE workNumber= '" + id + "';"; DriverPO driver = null; try { result = Helper.find(sql); if (result.next()) driver = new DriverPO( result.getString("name"), Work.valueOf(result.getString("work")), result.getString("workNumber"), result.getString("workPlaceNumber"), result.getString("birthDate"), result.getString("idNumber"), result.getString("phoneNumber"), result.getString("address"), Sex.valueOf(result.getString("sex")), result.getInt("driverYear"), result.getInt("page")); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return driver; }