Container enforces all the transactional rules for the session bean based upon information specified when the component was deployed.
Lacks developer specification of transaction boundaries.
Each method of a session bean can be assigned a transactional attribute at deployment.
Allows demarcation of transactions at beginning and end of methods.
6 different transaction attributes that are available to select for beans:
Not Supported: Method does not support transactions
Required: Method requires a transaction. EJB container creates a new transaction if the method is invoked without an existing transaction.
Supports: Method supports transaction. Will not create a new transaction but will execute as a part of an existing transaction if available.
RequiresNew: Method requires a new transaction. EJB container suspends existing transaction context and starts a new transaction.
Mandatory: The method must execute in an existing transaction context.
Never:
The method must not execute in a transaction context.
Bean-Managed Transaction Demarcation:
No help from the container
Initiate and terminate transactions for themselves using Java Transaction API.
More work but greater flexibility.
Not confined to demarcating transactions just at the beginning and end of methods.
Can begin a transaction in one method and commit later in another method. Also can begin and commit a transaction many times.
EJB Spec does not allow session beans to nest transactions.