public void listEmployees() {
        Session session = sessionFactory.openSession();
        Transaction tx = null;
        try {
            tx = session.beginTransaction();
            List<Employee> employees = session.createQuery("FROM Employee").list();
            
            allEmployees = new ArrayList<Employee>(employees.size());
            for (Employee e : employees) {
                allEmployees.add(e);
            }
            
            for (Iterator iterator1
                    = employees.iterator(); iterator1.hasNext();) {
                Employee employee = (Employee) iterator1.next();
                System.out.print("First Name: " + employee.getFirstName());
                System.out.print("  Last Name: " + employee.getLastName());
                System.out.println("  Salary: " + employee.getSalary());
                SortedMap<String, Certificate> map
                        = employee.getCertificates();
                for (Map.Entry<String, Certificate> entry : map.entrySet()) {
                    System.out.print("\tCertificate Type: " + entry.getKey());
                    System.out.println(",  Name: "
                            + (entry.getValue()).getName());
                }
            }
            tx.commit();
        } catch (HibernateException e) {
            if (tx != null) {
                tx.rollback();
            }
            e.printStackTrace();
        } finally {
            session.close();
        }
    }