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