Chapter 14. Managing transactions

This chapter covers

  • Transaction management overview

  • Implementing transaction management aspect

  • Implementing Spring's transaction management

  • Automatically retrying transactions

Consider the e-commerce example in appendix A. When you add an item to a cart, you remove it from the inventory. What would happen if the operation failed after you added an item to the cart but before it was removed from the inventory? The system would be in an inconsistent state, with the same item counted as being in the shopping cart and in the inventory. To prevent this undesirable situation, you need to execute both operations in a transaction. A transaction defines a unit of work that ensures that the system remains in a consistent state ...

Get AspectJ in Action now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.