J2EE.5.5 UserTransaction References


J2EE.5.5 UserTransaction References

Many J2EE application component types are allowed to use the JTA UserTransaction interface to start, commit, and abort transactions. Such application components can find an appropriate object implementing the UserTransaction interface by looking up the JNDI name java:comp/UserTransaction . The container is required to provide java:comp/UserTransaction only for those components that can validly make use of it. Any such UserTransaction object is valid only within the component instance that performed the lookup. See the individual component definitions for further information.

The following example illustrates how an application component acquires and uses a UserTransaction object.

 public void updateData(...) {    ...     // Obtain the default initial JNDI context.     Context initCtx = new InitialContext();     // Look up the UserTransaction object.     UserTransaction tx = (UserTransaction)initCtx.lookup(       "java:comp/UserTransaction");     // Start a transaction.     tx.begin();     ...     // Perform transactional operations on data.     ...     // Commit the transaction.     tx.commit();     ...  } 

J2EE.5.5.1 Application Component Provider's Responsibilities

The application component provider is responsible for using the defined name to look up the UserTransaction object. Only some application component types are required to have access to a UserTransaction object; see Table J2EE.6-1 in this specification and the EJB 1.1 specification for details.

J2EE.5.5.2 Deployer's Responsibilities

The deployer has no specific responsibilities associated with the UserTransaction object.

J2EE.5.5.3 J2EE Product Provider's Responsibilities

The J2EE product provider is responsible for providing an appropriate UserTransaction object as required by this specification.

J2EE.5.5.4 System Administrator's Responsibilities

The system administrator has no specific responsibilities associated with the User Transaction object.



Java 2 Platform, Enterprise Edition. Platform and Component Specifications
Java 2 Platform, Enterprise Edition: Platform and Component Specifications
ISBN: 0201704560
EAN: 2147483647
Year: 2000
Pages: 399

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net