Identify correct and incorrect statements or examples about transaction propagation semantics.

[Note]
  • [EJB_3.0_CORE] 13.6.2.1; 13.6.2.2; 13.6.2.3; 13.6.2.4; 13.6.2.5; 13.6.2.6; 13.6.2.7

NOT_SUPPORTED

The container invokes an enterprise bean method whose transaction attribute is set to the NOT_SUPPORTED value with an unspecified transaction context.

If a client calls with a transaction context, the container SUSPENDS the association of the transaction context with the current thread before invoking the enterprise bean's business method. The container RESUMES the suspended association when the business method has completed. The suspended transaction context of the client is not passed to the resource managers or other enterprise bean objects that are invoked from the business method.

If the business method invokes other enterprise beans, the container passes no transaction context with the invocation.

REQUIRED

The container must invoke an enterprise bean method whose transaction attribute is set to the REQUIRED value with a valid transaction context.

If a client invokes the enterprise bean's method while the client is associated with a transaction context, the container invokes the enterprise bean's method in the client's transaction context.

If the client invokes the enterprise bean's method while the client is NOT ASSOCIATED with a transaction context, the container AUTOMATICALLY STARTS a new transaction before delegating a method call to the enterprise bean business method. The container automatically enlists all the resource managers accessed by the business method with the transaction. If the business method invokes other enterprise beans, the container passes the transaction context with the invocation. The container attempts to commit the transaction when the business method has completed. The container performs the commit protocol before the method result is sent to the client.

SUPPORTS

The container invokes an enterprise bean method whose transaction attribute is set to SUPPORTS as follows:

The SUPPORTS transaction attribute must be used with caution. This is because of the different transactional semantics provided by the two possible modes of execution. Only the enterprise beans that will execute correctly in both modes should use the SUPPORTS transaction attribute.

REQUIRES_NEW

The container MUST invoke an enterprise bean method whose transaction attribute is set to REQUIRES_NEW with a NEW TRANSACTION CONTEXT.

If the client invokes the enterprise bean's method while the client is not associated with a transaction context, the container automatically STARTS a new transaction before delegating a method call to the enterprise bean business method. The container automatically enlists all the resource managers accessed by the business method with the transaction. If the business method invokes other enterprise beans, the container passes the transaction context with the invocation. The container attempts to commit the transaction when the business method has completed. The container performs the commit protocol before the method result is sent to the client.

If a client calls with a transaction context, the container SUSPENDS the association of the transaction context with the current thread before starting the new transaction and invoking the business method. The container RESUMES the suspended transaction association after the business method and the new transaction have been completed.

MANDATORY

The container must invoke an enterprise bean method whose transaction attribute is set to MANDATORY in a client's transaction context. The client is REQUIRED to call with a transaction context.

NEVER

The container invokes an enterprise bean method whose transaction attribute is set to NEVER WITHOUT a transaction context defined by the EJB specification. The client is required to call WITHOUT a transaction context.

Transaction Attribute Summary

The following table provides a summary of the transaction context that the container passes to the business method and resource managers used by the business method, as a function of the transaction attribute and the client's transaction context. T1 is a transaction passed with the client request, while T2 is a transaction initiated by the container.

Table 9.1.  Transaction Attribute Summary

Transaction attributeClient's transactionTransaction associated with business methodTransaction associated with resource managers

NOT_SUPPORTED

none

none

none

T1

none

none

REQUIRED

none

T2

T2

T1

T1

T1

SUPPORTS

none

none

none

T1

T1

T1

REQUIRES_NEW

none

T2

T2

T1

T2

T2

MANDATORY

none

ERROR

N/A

T1

T1

T1

NEVER

none

none

none

T1

ERROR

N/A

Professional hosting     Belorussian informational portal         Free SCWCD 1.4 Study Guide     Free SCDJWS 1.4 Study Guide     SCDJWS 1.4 Quiz     Free IBM Certified Associate Developer Study Guide     IBM Test 000-287. Enterprise Application Development with IBM WebSphere Studio, V5.0 Study Guide     Free Mock Exam Engine