Chapter 6. Transaction and Resource Management

This chapter discusses general issues relating to resource and transaction management. We will start with a basic overview of the subject, followed by a discussion of how Spring's transaction management features fit into the bigger picture.

You will see examples of how to configure and use the transactional features that Spring provides in a variety of environments. We will cover local transactions with a single database and distributed "global" transactions in a J2EE system.

We will see how Spring provides powerful declarative and transaction management services, and offers a consistent programming model in all environments.

Background

Transaction processing in J2EE applications is a large topic that merits an entire book for thorough coverage. For a more in-depth discussion we recommend Java Transaction Processing: Design and Implementation by Mark Little, Jon Maron, and Greg Pavlik (Prentice Hall PTR, 2004).

The following discussion will give you enough background to be able to understand Spring's transaction support.

What Is a Transaction?

For the discussion here, we will define a transaction as a unit of work that is made up of a set of operations, against one or more resources, that must be completed in its entirety. One example of a transaction is when you go to the bank and transfer money from your savings account to your checking account. First your savings account is debited and then your checking account is credited. If the credit ...

Get Professional Java™ Development with the Spring Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.