Using a deployment descriptors for transactions
Transaction types can be specified using annotations or deployment descriptors. In this recipe, we illustrate how to use a deployment descriptor to specify the transaction type for an EJB and its methods.
The process for creating a deployment descriptor for transactions includes:
- Creating an
ejb-jar.xmlfile for the EJB module
- Using the
<container-transaction>element to define interceptors
- Deploying the application
We will base this example on the
PopulationManager class from the Chapter 6, Understanding how the TransactionAttributeType affects transactions recipe. The
PopulationManager class as shown below, uses container-managed transactions and annotates the
updateCityPopulation method ...