Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage Guides Java Transaction Design Strategies

Java Transaction Design Strategies


Understanding how transaction management works in Java and developing an effective transaction design strategy can help to avoid data integrity problems in your applications and databases and ease the pain of inevitable system failures.

This book is about how to design an effective transaction management strategy using the transaction models provided by Java-based frameworks such as EJB and Spring. Techniques, best practices, and pitfalls with each transaction model will be described. In addition, transaction design patterns will bring all these concepts and techniques together and describe how to use these models to effectively manage transactions within your EJB or Spring-based Java applications.  

Free download, buy the print version for $22.95

If you enjoyed reading the free downloadable version, please support the author as well as future InfoQ books by purchasing the print copy for only $22.95 or


Table of Contents


  • Transaction Models
  • Where’s the ACID, Man?
  • JTA and JTS
  • UserTransaction Interface
  • TransactionManager Interface
  • EJBContext Interface
  • Status Interface

The Local Transaction Model

  • Auto Commit and Connection Management
  • Local Transaction Considerations and Limitations

The Programmatic TransactionModel

  • Obtaining a Reference to the
  • JTA UserTransaction
  • Programmatic Transaction Coding Traps
  • The Transaction Context Problem
  • Programmatic Transaction Scenarios

The Declarative Transaction Model

  • Transaction Attributes
  • Specifying Transaction Attributes
  • Exception Handling and thesetRollback() Method
  • EJB 3.0 Considerations
  • setRollbackOnly() Alternative
  • Using Required vs. Mandatory
  • Transaction Attributes
  • The Reality of Transaction Isolation Levels

XA Transaction Processing

  • The XA Interface Explained
  • When Should You Use XA?
  • Two-Phase Commit
  • Heuristic Exception Processing
  • Enabling Queues and Topics for XA
  • Enabling Databases for XA

Client Owner Transaction  Design Pattern
Domain Service Owner Transaction Design Pattern
Server Delegate Owner Transaction Design Pattern

About the author

Mark Richards is Certified Senior IT Architect at IBM, where he is involved in the architecture and design of large-scale Service Oriented Architectures in J2EE and other technologies, primarily in the financial services industry. He has been involved in the software industry as a developer, designer, and architect since 1984, speaks frequently at the No Fluff Just Stuff Symposiums and holds a Masters Degree in Computer Science from Boston University, and holds a number of Sun, IBM, and BEA Java and architect certifications.  Feel free to email Mark with any comments or questions about the book.