Transaction management is the process of managing a set of statements or commands. In hibernate; transaction management is done by transaction interface as shown in below code:
- Session s = null;
- Transaction tr = null;
- try {
- s = sessionFactory.openSession();
- tr = s.beginTransaction();
- doTheAction(s);
- tr.commit();
- } catch (RuntimeException exc) {
- tr.rollback();
- } finally {
- s.close();
- }
No comments:
Post a Comment