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

    injecting the TransactionManager in Seam

    asookazian

      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

        • 1. Re: injecting the TransactionManager in Seam
          kapitanpetko

          There are no Seam components for this, AFAIK. On JBoss 4.2.3 it's under java:/TransactionManager.
          You might get errors if you use it though, since you are supposed to use only UserTransaction form BMT.


          Cf JNDIView in your JMX console:


          java: Namespace
          
            +- TransactionManager (class: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate)