title: What is the difference between TransactionManager.begin() and QuarkusTransaction.begin()?
body: <p>Quarkus 2.8.0.Final introduced <a href="https://quarkus.io/guides/transaction#programmatic-approach" rel="nofollow noreferrer">QuarkusTransaction</a>. What is the difference between</p>
  <pre><code>@ApplicationScoped
  public class MyClass {
  
      @Inject
      TransactionManager tm;
  
      public void doSomething() throws Exception {
          tm.begin();
          // ...
          tm.commit();
      }
  }
  </code></pre>
  <p>and</p>
  <pre><code>@ApplicationScoped
  public class MyClass {
  
      public void doSomething() {
          QuarkusTransaction.begin();
           // ...
          QuarkusTransaction.commit();
       }
  }
  </code></pre>
  <p>?</p>
  <p>I am using the TransactionManager in a lot of my tests, and when I replaced it with QuarkusTransaction, I am getting different error messages when something fails:</p>
  <p>When using the TransactionManager, I am getting</p>
  <blockquote>
  <p>javax.transaction.NotSupportedException: BaseTransaction.checkTransactionState - ARJUNA016051: thread is already associated with a transaction!</p>
  </blockquote>
  <p>When using QuarkusTransaction, I am getting</p>
  <blockquote>
  <p>javax.enterprise.context.ContextNotActiveException</p>
  </blockquote>
  <p>The Quarkus documentation does not really explain why QuarkusTransaction was introcuded </p>