Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Enterprise JavaBeans™ Specification, Version 2.0 - Sun Microsystems.pdf
Скачиваний:
14
Добавлен:
24.05.2014
Размер:
2.71 Mб
Скачать

Sun Microsystems Inc.

Support for Transactions

Enterprise JavaBeans 2.0, Public Draft

Bean Provider’s responsibilities

Figure 71 Multiple updates in a local transaction

client

EJB Server

 

X Y

database A

The application programmer does not have to do anything to ensure transactional semantics. The enterprise Beans X and Y perform the database updates using the standard JDBC™ API. Behind the scenes, the EJB Server enlists the database connections as part of a local transaction, and uses the same underlying physical connection for the two beans.

16.4 Bean Provider’s responsibilities

This section describes the Bean Provider’s view of transactions and defines his responsibilities.

16.4.1 Bean-managed versus container-managed transaction demarcation

When designing an enterprise bean, the Bean Provider must decide whether the enterprise bean will demarcate transactions programmatically in the business methods (bean-managed transaction demarcation), or whether the transaction demarcation is to be performed by the Container based on the transaction attributes in the deployment descriptor (container-managed transaction demarcation).

A Session Bean or a Message-driven Bean can be designed with bean-managed transaction demarcation or with container-managed transaction demarcation. (But it cannot be both at the same time.)

An Entity Bean must always be designed with container-managed transaction demarcation.

An enterprise bean instance can access resource managers in a transaction only in the enterprise bean’s methods in which there is a transaction context available. An entity bean with container managed persistence can access its persistent state in a transaction only in the enterprise bean’s methods in which there is a transaction context available. Refer to Table 2 on page 68, Table 3 on page 78, Table 4 on page 151, Table 7 on page 229, and Table 9 on page 288.

5/31/00

308