public List<Borrower> ListBorrower() throws Exception {
   ConnectionUtil c = new ConnectionUtil();
   Connection conn = c.createConnection();
   try {
     BorrowerDAO bdao = new BorrowerDAO(conn);
     List<Borrower> bor = bdao.readAll();
     conn.commit();
     return bor;
   } catch (Exception e) {
     e.printStackTrace();
     return null;
   } finally {
     conn.close();
   }
 }
Exemplo n.º 2
0
  private Borrower showAllBorrowers() {
    Borrower bor = null;
    try {
      Connection conn = getConnection();
      BorrowerDAO borDAO = new BorrowerDAO(conn);
      List<Borrower> allBorrowers = borDAO.readAll();
      ArrayList<String> actions = new ArrayList<String>();
      actions.add("Cancel");
      int choice = getChoiceNumber(allBorrowers, actions);
      if (choice > 0 && choice <= allBorrowers.size()) {
        bor = allBorrowers.get(choice - 1);
      }
      conn.close();
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    return bor;
  }