13.1 Introduction to Spring Framework transaction management
Comprehensive transaction support is among the most compelling reasons to use the Spring Framework. The Spring Framework provides a consistent abstraction for transaction management that delivers the following benefits:
Consistent programming model across different transaction APIs such as Java Transaction API (JTA), JDBC, Hibernate, and Java Persistence API (JPA).
Support fordeclarative transaction management.
Simpler API forprogrammatictransaction management than complex transaction APIs such as JTA.
Excellent integration with Spring’s data access abstractions.
The following sections describe the Spring Framework’s transaction value-adds and technologies. (The chapter also includes discussions of best practices, application server integration, and solutions to common problems.)
Advantages of the Spring Framework’s transaction support modeldescribes_why_you would use the Spring Framework’s transaction abstraction instead of EJB Container-Managed Transactions (CMT) or choosing to drive local transactions through a proprietary API such as Hibernate.
Understanding the Spring Framework transaction abstractionoutlines the core classes and describes how to configure and obtain
DataSource
instances from a variety of sources.Synchronizing resources with transactionsdescribes how the application code ensures that resources are created, reused, and cleaned up properly.
Declarative transaction managementdescribes support for declarative transaction management.
Programmatic transaction managementcovers support for programmatic (that is, explicitly coded) transaction management.
Transaction bound eventdescribes how you could use application events within a transaction.