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