top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How transaction management works in Hibernate?

0 votes
342 views
How transaction management works in Hibernate?
posted Sep 9, 2017 by Kumar Neeraj

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Transaction management is very easy in hibernate because most of the operations are not permitted outside of a transaction. So after getting the session from SessionFactory, we can call session beginTransaction() to start the transaction. This method returns the Transaction reference that we can use later on to either commit or rollback the transaction.

Overall hibernate transaction management is better than JDBC transaction management because we don’t need to rely on exceptions for rollback. Any exception thrown by session methods automatically rollback the transaction.

answer Sep 11, 2017 by Sonali Gupta
...