Transactions
The Enterprise JavaBeans Version 2.1 architecture specifies three alternative commit-time options with respect to the instance state.
They are described as options A, B, and C in the specification document. For complete details on these options, refer to Sun Microystem's Enterprise JavaBean's version 2.1 specification document:http://java.sun.com/products/ejb/docs.html .
In option C, the enterprise bean container does not cache a "ready" instance between transactions. As soon as a transaction has completed, the instance is returned to the pool of available instances. WebSphere Commerce uses option C because the database is shared across multiple WebSphere Commerce applications. In this implementation, the container loads persistent data for entity beans at the start of each transaction and the entity beans are only cached for the duration of the transaction. The container activates multiple instances of an entity bean, one for each transaction in which the entity is being accessed. Transaction synchronization is performed by the database.
The transaction attribute of each enterprise bean is set to TX_REQUIRED
.
Since the solution controller starts a transaction before executing
a command that accesses an enterprise bean (through its corresponding
access bean), the business methods of the enterprise bean are invoked
within the context of this transaction.