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

Sun Microsystem Inc

Container Provider responsibilities

Enterprise JavaBeans v1.1, Final Release

Support for Transactions

11.6.2.10 Handling of getUserTransaction() method

If an instance of an enterprise bean with container-managed transaction demarcation attempts to invoke the getUserTransaction() method of the EJBContext interface, the Container must throw the java.lang.IllegalStateException.

11.6.2.11 javax.ejb.SessionSynchronization callbacks

If a Session Bean class implements the javax.ejb.SessionSynchronization interface, the Container must invoke the afterBegin(), beforeCompletion(), and afterCompletion(...) callbacks on the instance as part of the transaction commit protocol.

The Container invokes the afterBegin() method on an instance before it invokes the first business method in a transaction.

The Container invokes the beforeCompletion() method to give the enterprise bean instance the last chance to cause the transaction to rollback. The instance may cause the transaction to roll back by invoking the EJBContext.setRollbackOnly() method.

The Container invokes the afterCompletion(Boolean committed) method after the completion of the transaction commit protocol to notify the enterprise bean instance of the transaction outcome.

11.6.3 Handling of methods that run with “an unspecified transaction context”

The term “an unspecified transaction context” is used in the EJB specification to refer to the cases in which the EJB architecture does not fully define the transaction semantics of an enterprise bean method execution.

This includes the following cases:

The execution of a method of an enterprise bean with container-managed transaction demarca-

tion for which the value of the transaction attribute is NotSupported, Never, or Supports[12].

The execution of the ejbCreate, ejbRemove, ejbPassivate, and ejbActivate methods of a session bean with container-managed transaction demarcation.

[12]For the Supports attribute, the handling described in this section applies only to the case when the client calls without a transaction context.

179

11/24/99