public List getAllStudents() throws SQLException { Session session = null; List studs = new ArrayList(); try { session = HibernateUtil.getSessionFactory().openSession(); studs = session.createCriteria(Student.class).list(); } catch (Exception e) { JOptionPane.showMessageDialog(null, e.getMessage(), "Ошибка I/O", - public List getAllStudents() throws SQLException { Session session = null; List studs = new ArrayList(); try { session = HibernateUtil.getSessionFactory().openSession(); studs = session.createCriteria(Student.class).list(); } catch (Exception e) { JOptionPane.showMessageDialog(null, e.getMessage(), "Ошибка I/O",
- JOptionPane.OK_OPTION); } finally { if (session != null && session.isOpen()) { session.close(); } } return studs; }
Достарыңызбен бөлісу: |