Transaction Management

Hibernate Transaction Management

Transaction simply represents a unit of work ,In such case, if one step fails, the whole transaction fails.

  • The methods of Transaction interface are as follows:
    * void begin() starts a new transaction.
    * void commit() ends the unit of work unless we are in FlushMode.NEVER.
    * void rollback() forces this transaction to rollback.
    * boolean wasCommited() checks if the transaction is commited successfully.
    * boolean wasRolledBack() checks if the transaction is rolledback successfully.

Example of Transaction Management in Hibernate

Transaction associated with Dao layer
spring-config.xml

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sanjay Singh

Sanjay Singh

Java||Spring-Boot|| Micro services Application developer|| INDIA