Name
ACID Transaction Pattern
Goal
To perform multiple actions on a set of resources while ensuring that the underlying resources always remain in a correct state (Figure B-14).
Participants
- Business logic
Provides the application with its underlying constraints and process flow.
- Transaction management layer
Provides code for coordinating the business logic and data access logic to ensure that all transactions meet a set of requirements.
- Persistence layer
Responsible for storing data in persistent storage, usually (but not necessarily) a database.
Interactions
All business and data-access logic route any changes to data via a transaction manager object. The transaction manager acts as a gateway either to the persistence layer of the application or to the domain object model itself. It is responsible for ensuring that all permanent changes to the data underlying the application are atomic (treatable as a single unit rather than a set of individual changes), consistent (consistent with its business rules and constraints at the end of each transaction), isolated (do not interfere with other simultaneous transactions), and durable (changes made in the course of a successful transaction become part of the permanent state of the system).
Notes
In an EJB environment, the transaction manager is embedded within the application server. When using ...
Get J2EE Design Patterns 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.