Define transaction management

broken image

With local transaction, all the transaction code is within our code. Local Transactions: Local transactions happen between the application and a singled RDBMS, such as a simple JDBC connection.

broken image

This is a complex process and requires knowledge at the application server level. JTA or java transaction API is required with the support of JNDI to lookup different databases, and the transaction manager decides the commit or rollback of the distributed transaction. The transaction manager cannot sit within the application to handle it, rather it sits in the application server level. This is called distributed transaction processing. Global Transactions: There can be applications (very unlikely) where the transaction can happen between different databases. We call it a rollback of all the steps in the transaction if anything fails in between. If one of them fails, the entire process fails. Here, the unit of work is money debiting from Account A and money crediting to Account B.

broken image

Transaction management is a vast topic, hence I am dividing this article into two sections: This article will cover the Spring transaction management in detail.

broken image