Java Transaction API (JTA)
Transaction SupportA transaction is a unit of work or a set of tasks that must be executed together. Transactions are atomic; that is, all the tasks in a transaction must complete successfully before the transaction can be considered complete. If a transaction fails, the state of business must be the same state it was in before the transaction began. JDBC and EJBs both incorporate support for transactions. Additionally, the Java Transaction API (JTA) provides a way for J2EE components and clients to manage their own transactions and for multiple components to participate in a single transaction. Declarative Transaction ModelOne of the primary advantages of using Enterprise JavaBeans (EJBs) is the support they provide for declarative transactions. In the declarative transaction model, attributes are associated with beans at deployment time. It is the container's responsibility, based on the attribute value, to demarcate and transparently propagate transactional context. The container is also responsible, with a Transaction Manager, for ensuring that all participants in the transaction see a consistent outcome. Declarative transactions free the programmer from explicitly demarcating transactions. They facilitate component-based applications where multiple components, potentially distributed and updating heterogeneous resources, can participate in a single transaction. |