Given a list of responsibilities, identify whose which are the Container's with respect to transactions, including the handling of getRollbackOnly, setRollbackOnly, getUserTransacti

This page discusses - Given a list of responsibilities, identify whose which are the Container's with respect to transactions, including the handling of getRollbackOnly, setRollbackOnly, getUserTransacti

Tutorials   
Chapter 5. Client View of an Entity Identify correct and incorrect statements about the Application Assembler's responsibilities, including the use of deployment descriptor elements related to transactions and the identifica Given a list of responsibilities, identify whose which are the Container's with respect to transactions, including the handling of getRollbackOnly, setRollbackOnly, getUserTransacti EJB Transactional Attributes Chapter 11. Transactions Given a list of scenarios, identify which will result in an ejbRemove method not being called on a bean instance. Given a list of responsibilities related to session beans, identify those which are the responsibility of the session bean provider and those which are the responsibility of the EJB contai Given a list of methods for a stateful or stateless session bean class, define which of the following operations can be performed from each of those methods: SessionContext interface metho Chapter 4. Session Bean Life Cycle Identify correct and incorrect statements or examples about the client view of a session bean's local and remote component interfaces. Identify the interface and method for each of the following: retrieve the session bean's remote home interface, retrieve the session bean's local component interface, determine if the sessio Match the correct description about purpose and function to which session bean type they apply: stateless, stateful, or both. Chapter 14. Security Management Given a security-related deployment descriptor tag, identify correct and incorrect statements and code related to that tag. Given a list of responsibilities, identify which belong to the deployer, bean provider, application assembler, container provider, system administrator, or any combination. From a list of responsibilities, identify which belong to the application assembler, bean provider, deployer, container provider, or system administrator. Part I. Exam Objectives Preface Identify the interfaces and methods a JMS message-driven bean must implement. Identify the use and behavior of the MessageDrivenContext interface methods. SCBCD Study Guide Given a list of responsibilities related to exceptions, identify those which are the bean provider's, and those which are the responsibility of the container provider. Be prepared to recog Given a particular method condition, identify the following: whether an exception will be thrown, the type of exception thrown, the container's action, and the client's view. Identify correct and incorrect statements or examples about application exceptions and system exceptions in entity beans, session beans, and message-driven beans. Identify correct and incorrect statements or examples about the client's view of exceptions received from an enterprise bean invocation. Identify correct and incorrect statements or examples about an entity bean's primary key and object identity. Identify the use, syntax, and behavior of, the following entity bean home method types, for Container-Managed Persistence (CMP); finder methods, create methods, remove methods, and home me Chapter 8. Entity Beans Chapter 13. Enterprise Bean Environment Chapter 2. Client View of a Session Bean Match EJB roles with the corresponding description of the role's responsibilities, where the description may include deployment descriptor information. Given a list, identify which are requirements for an EJB-jar file. Identify correct and incorrect statements or examples about the client view of a entity bean's remote component interface (EJBObject). Identify correct and incorrect conditional expressions, BETWEEN expressions, IN expressions, LIKE expressions, and comparison expressions. Identify correct and incorrect statements or examples about the purpose and use of EJB QL. Chapter 9. EJB-QL Identify correct and incorrect statements or examples about EJB programming restrictions. Chapter 1. EJB Overview Identify EJB 2.0 container requirements. Identify correct and incorrect statements or examples about the client view of an entity bean's local component interface (EJBLocalObject).

Ads

Ads

Given a list of responsibilities, identify whose which are the Container's with respect to transactions, including the handling of getRollbackOnly, setRollbackOnly, getUserTransaction, SessionSynchronzation callbacks, for both container and bean-managed transactions.

Bean-managed transaction demarcation (BMT)

NOTE, only Session and Message-driven beans can be used with bean-managed transaction demarcation. A Bean Provider is not allowed to provide an Entity bean with bean-managed transaction demarcation.

The Container must make the javax.transaction.UserTransaction interface available to the enterprise bean's business method or onMessage method via the javax.ejb.EJBContext interface and under the environment entry java:comp/UserTransaction. When an instance uses the javax.transaction.UserTransaction interface to demarcate a transaction, the Container must enlist all the resource managers used by the instance between the begin() and commit() or rollback() methods with the transaction. When the instance attempts to commit the transaction, the Container is responsible for the global coordination of the transaction commit.

In the case of a STATEFUL session bean, it is POSSIBLE that the business method that started a transaction completes without committing or rolling back the transaction. In such a case, the Container must retain the association between the transaction and the instance across multiple client calls until the instance commits or rolls back the transaction. When the client invokes the next business method, the Container must invoke the business method in this transaction context.

If a STATELESS session bean instance starts a transaction in a business method, it MUST COMMIT the transaction before the business method returns. The Container must detect the case in which a transaction was started, but not completed, in the business method, and handle it as follows:

  • Log this as an application error to alert the system administrator.

  • Roll back the started transaction.

  • Discard the instance of the session bean.

  • Throw the java.rmi.RemoteException to the client if the client is a remote client, or throw the javax.ejb.EJBException if the client is a local client.

If a message-driven bean instance starts a transaction in the onMessage method, it must commit the transaction before the onMessage method returns. The Container must detect the case in which a transaction was started, but not completed, in the onMessage method, and handle it as follows:

  • Log this as an application error to alert the system administrator.

  • Roll back the started transaction.

  • Discard the instance of the session bean.

When an instance attempts to start a transaction using the begin() method of the javax.transaction.UserTransaction interface while the instance has not committed the previous transaction, the Container must throw the javax.transaction.NotSupportedException in the begin() method.

The Container must throw the java.lang.IllegalStateException if an instance of a bean with bean-managed transaction demarcation attempts to invoke the setRollbackOnly() or getRollbackOnly() method of the javax.ejb.EJBContext interface.

Container-managed transaction demarcation (CMT)

The Container must handle the EJBContext.setRollbackOnly() method invoked from a business method executing with the Required, RequiresNew, or Mandatory (for MDB - ONLY with Required) transaction attribute as follows:

  • The Container must ensure that the transaction will never commit. Typically, the Container instructs the transaction manager to mark the transaction for rollback.

  • If the Container initiated the transaction immediately before dispatching the business method to the instance (as opposed to the transaction being inherited from the caller), the Container must note that the instance has invoked the setRollbackOnly() method. When the business method invocation completes, the Container must roll back rather than commit the transaction. If the business method has returned normally or with an application exception, the Container must pass the method result or the application exception to the client after the Container performed the rollback.

The Container must throw the java.lang.IllegalStateException if the EJBContext.setRollbackOnly() method is invoked from a business method executing with the Supports, NotSupported, or Never (for MDB - ONLY with NotSupported) transaction attribute.

The Container must handle the EJBContext.getRollbackOnly() method invoked from a business method executing with the Required, RequiresNew, or Mandatory (for MDB - ONLY with Required) transaction attribute.

The Container must throw (and log - MDB ONLY) the java.lang.IllegalStateException if the EJBContext.getRollbackOnly() method is invoked from a business method executing with the Supports, NotSupported, or Never (for MDB - ONLY with NotSupported) transaction attribute.

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 (and log - MDB ONLY) the java.lang.IllegalStateException.

If a Session Bean (STATEFUL ONLY) 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.

Visit http://java.boot.by  for the updates.

Advertisements

Share on Google+Share on Google+

Given a list of responsibilities, identify whose which are the Container's with respect to transactions, including the handling of getRollbackOnly, setRollbackOnly, getUserTransacti

Posted on: April 18, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 
Comments:0

Ads

 

Ads