Hibernate - Transaction Management
Transaction Management:
- Transaction management is controlling the transaction at run time time.
- For Example, Transaction management code has to decide if transaction get success what need to do and transaction is failed how to catch and what need to do
Eg:
Session s= null;
Transaction t =null;
try{
s = sessionFactory.openSession();
t =session.beginTransaction();
// Actual SQL Activities Need to do here.
t.commit();
}
catch(Exception e){
t.rollback();
}
finally{
s.close();
}
Comments
Post a Comment