This section defines the transaction support requirements for the J2EE product provider. J2EE.4.2.1 Web ComponentsServlets and JSP pages are allowed to demarcate transactions using the javax.transaction.UserTransaction interface, defined in the JTA specification. These web components are allowed to access multiple resource managers and invoke multiple enterprise beans within a single transaction. The web component assumes that the transaction is automatically propagated to the enterprise beans (subject to the enterprise bean transaction attributes, e.g., such beans must use container managed transactions) and transactional resource managers. The J2EE platform must meet the following requirements:
The product provider is not required to support import of a transaction context by a web component from its client. The product provider is not required to support transaction context propagation across multiple web components accessed via an HTTP request. If a web component associated with a transaction makes an HTTP request to another web component, the transaction context is not propagated to the target servlet or page. (The HTTP protocol does not support such transaction context propagation.) However, when another web component is invoked through the RequestDispatcher interface, any active transaction context must be propagated to the called web component. A web component may start a transaction only in its service method. A transaction that is started by a servlet or JSP page must be completed before the service method returns. That is, transactions may not span web requests from a client. Returning from the service method with an active transaction context is an error. The web container is required to detect this error and abort the transaction. There are many subtle and complex interactions between the use of transactional resources, threads, and JDBC connections. To ensure correct operation, web components should obey the following guidelines, and the web container must support at least these usages.
J2EE.4.2.2 Enterprise JavaBeans ComponentsThe J2EE product provider must implement support for transactions as defined in the EJB specification. J2EE.4.2.3 Application ClientsThe J2EE product provider is not required to provide any transaction management support for application clients. J2EE.4.2.4 Applet ClientsThe J2EE product provider is not required to provide any transactional management support for applets. J2EE.4.2.5 Transactional JDBC Technology SupportA J2EE product must support at least a JDBC technology database as a transaction resource manager. The platform must enable transactional JDBC API access from servlets, JSP pages, and enterprise beans. It must be possible to access the JDBC technology database from multiple application components within a single transaction. For example, a servlet may wish to start a transaction, access a database, invoke an enterprise bean that accesses the same database as part of the same transaction, and finally commit the transaction. |