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.

Getting ready

The process for creating a deployment descriptor for transactions includes:

  • Creating an ejb-jar.xml file 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 ...

Get EJB 3.1 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.