When a transaction executes as part of a stateful session bean, the bean can receive synchronous notifications of the progress of the transaction using the SessionSynchronization
interface. While there is not a specific field or variable which indicates the state of a transaction when using CMT, the invocation of one of its interface methods implies the transaction's state.
One possible use of this technique is to synchronize the instance variables of the bean to their corresponding values in a database. In this recipe, we will examine how the interface works. In the next recipe, Understanding how the TransactionAttributeType affects transactions, we will demonstrate how CMT work with different transaction attribute type settings.