About the author
I came across this book by Mark Richards- Java Transaction Design Strategies. For those who are not from Boston area- mark is a much familiar face in the NEJUG meetings- ever second Thursday. He served as the President for quite some time.
The book is about Transactions- in java applications- using EJB or Spring
Mark has done a good job of drawing a distinction between Transaction Models vs Transaction Strategies. Transaction Model is how you declare your transactions. Transaction strategy on the other hand is putting together a strategy on where to put transactions and who is responsible for what.
Throughout the book- he draw examples and contrasts Spring and EJB.
Code examples are minimal- its more of easy to read and grasp language. I personally do not like books with lots of code- so this went well with me. This book has been deliberately written in a concise manner – which it makes it easy to read and finish
The book is divided in two parts. The first part introduces the three Transaction Models- Local Transaction Model, Programmatic Model, Declarative Model. It also provides a recap of common transaction related terms- JTA ,JTS, ACID, Isolation levels,XA transactions, Two phase commit,Heuristic Transactions, LPS
Second Part discusses three design patterns- Client Owner Transaction Design pattern, Domain Service Owner Transaction Design Pattern,Server Delegate Owner Transaction Design Pattern.
Best Practices suggested in this book:
In declarative transactions: Make the class level transaction- most restrictive , and then fine tune for individual methods as needed
The method that starts the transaction- should be the one to commit or rollback
If a method requires a transaction context – but is not responsible for marking it as rollback- then it should have an attribute of Mandatory
Use XA only of you have multiple resources participating – in tech same transaction context
I enjoyed reading the book and would recommend to anyone- seeking a quick and clean introduction to Transactions with a touch of Java and Spring
You can get the book from here