Transaction support in WAS
A transaction is a logical unit of work within which multiple updates to resources can be made atomic (as an indivisible unit of work) such that all or none of the updates are made permanent.
For example, multiple SQL statements to a relational database are committed atomically by the database during the processing of an SQL COMMIT statement. In this case, the transaction is contained entirely within the database manager and can be thought of as a RMLT.
The way that applications use transactions depends on the type of application component, as follows:
- A session bean can either use container-managed transactions or bean-managed transactions
- Entity beans use container-managed transactions.
- Web components (servlets) use bean-managed transactions.
WAS is a transaction manager that supports the coordination of resource managers through their XAResource interface and participates in distributed global transactions with other OTS 1.2 compliant transaction managers (for example J2EE 1.3 appservers).
Resource managers that offer transaction support can be categorized into those that support two-phase coordination (XAResource) and those that support only one-phase coordination (LocalTransaction).
The ActivitySession service (of WBI Server Foundation) provides an alternative unit-of-work (UOW) scope to that provided by global transaction contexts. It is a distributed context that can be used to coordinate multiple one-phase resource managers. The WebSphere EJB container and deployment tooling support ActivitySessions as an extension to the J2EE programming model. EJBs can be deployed with lifecycles that are influenced by ActivitySession context, as an alternative to transaction context. An application can then interact with a resource manager through its LocalTransaction interface for the period of a client-scoped ActivitySession rather than just the duration of an EJB method.