Otra SCBCD - UserTransaction y Contenedor EJB

(Imagen: Henri Matisse - Retrato de Madame Matisse)

FooBean is an EJB 3.0 session bean that can make valid use of UserTransaction. Which is guaranteed to work ina n EJB Container for FooBeaan to obtain the userTransaction object?

  • Invoke a method on a SessionCOntext that returns a UserTransaction object
  • Perform JNDI lookup with name "java:/UserTransaction" on an InitialContext
  • Perform JNDI lookup with the name "jdbc/UserTransaction" on an InitialContext
  • Use the @TransactionManagement annotation to inject an instance variable of type UserTransaction in a bean class.

Un contenedor EJB debe incluir JTA 1.1, y debe proveer la interfaz javax.transaction.UserTransaction a los EJB's que utilicen BMT (bean-managed transaction) a través de la interfaz javax.ejb.EJBContext (recordar que SessionContext hereda- es subclase - de EJBContext) y por medio de JNDI bajo el nombre de java:comp/UserTransaction (que no fihura en ninguna de las opciones).

Respuesta corta y precisa que nos lleva a escoger la primera alternativa

Pregunta tomada de ExamWorx

Publicar un comentario