1 Reply Latest reply on Aug 12, 2009 5:52 AM by Nikolay Elenkov

    injecting the TransactionManager in Seam

    Arbi Sookazian Master

      If I was able to inject the javax.transaction.TransactionManager interface in a Seam component, for example a session bean using BMT as follows:


      @Stateless
      @TransactionManagement(TransactionManagementType.BEAN)
      public class HelloBean implements HelloBeanLocal {...}



      I would be able to do:


      @In 
      private TransactionManager txMgr;
      
      @In
      private UserTransaction utx;
      
      private XAResource xaRes1;
      private XAResource xaRes2;
      
      public void foo() {
         Transaction tx = txMgr.getTransaction();
         utx.begin();
         
         tx.enlistResource(xaRes1);
         tx.enlistResource(xaRes2);
      
         utx.commit();
      }



      to manually enlist resources into my distributed tx.



      Is it possible to inject TransactionManager in a Seam component using @In?  And if not, is it possible to do it using JNDI lookup?


      How can I check to see what XAResources have been enlisted in a distributed tx in this API?


      http://java.sun.com/javaee/5/docs/api/javax/transaction/package-summary.html