If you use a container-managed transaction, you can automatically start the transaction just before the Enterprise Bean business method is invoked and automatically commit the transaction immediately after the processing of the business method ends. The transaction management processing need not be coded as a user program coding at all, and you can easily manage the transactions for accessing the resources.
The following figure shows the sequence for using the container-managed transactions.
Figure 3-13 Sequence for using the container-managed transactions
![[Figure]](figure/zu031200.gif)
Remember the following points when you use the container-managed transactions:
- When you use the container-managed transactions, you can specify the transaction attributes for each Enterprise Bean method. You can specify either Required, RequiresNew, Mandatory, Supports, NotSupported, or Never. To use the transaction, specify Container in the <transaction-type> tag of the DD, and specify the transaction attributes for each method in the <trans-attribute> tag. You can also specify the definition in an annotation without using the DD. For details on the transaction attributes, see 2.7.3 CMT in the uCosminexus Application Server EJB Container Functionality Guide. For details on the annotations, see 2. Annotations and Dependency Injection supported by Application Server in the uCosminexus Application Server API Reference Guide.
- When you access the resources in the business method used after the transaction is started, the resource access transactions are automatically managed.
- To access multiple resources after the transaction starts, you must use a resource adapter that supports the global transactions, and set the transaction support level of the resource adapter to XATransaction.
- When you use the container-managed transactions, you need not code the processing for transaction management as the user program coding.
- You can use the container-managed transactions with Enterprise Beans. The container-managed transactions cannot be used with servlets and JSPs.