title: ARJUNA016053: Could not commit transaction - JavaEE6 Timer
body: <p>We have a timer that triggers a job and do some import / export processing. But on commit we open encounter the error in the title. We've tried several solutions already:</p>
  
  <p>1.) Created 2 class:</p>
  
  <pre><code>@Stateless
  public class MyBean { 
      @Inject
      @JpaForJobs
      private EntityManager em;
  
      @Inject
      private MyService1 service1;
  
      @TransactionAttribute(TransactionAttributeType.REQUIRED)
      public void migrate(...) {
          service1.create(...);
      }
  }
  @Startup
  @Singleton
  public class MyService1 implements Job {
      @Resource
      TimerService timerService;
  
      @Inject
      private MyBean myBean;
  
      @Timeout
      public void trigger(Timer timer) {
          migrate();
      }
  
      private void migrate() {
          myBean.migrate();
      }
  }
  </code></pre>
  
  <p>Works sometimes but when the relationship gets complicated it fail. Example Customer has Student has Parents has Cats.</p>
  
  <p>I also tried bean managed transaction but same ending:</p>
  
  <pre><code>@Stateless
  @TransactionManagement(TransactionManagementType.BEAN)
  public class MyBean { 
      @Inject
      @JpaForJobs
      private EntityManager em;
  
      @Inject
      private MyService1 service1;
  
      public void migrate(...) {
          utx.begin();
          service1.create(...);
          utx.commit();
      }
  }
  @Startup
  @Singleton
  public class MyService1 implements Job {
      @Resource
      TimerService timerService;
  
      @Inject
      private MyBean myBean;
  
      @Timeout
      public void trigger(Timer timer) {
          migrate();
      }
  
      private void migrate() {
          myBean.migrate();
      }
  }
  </code></pre>
  
  <p>Any idea or suggestions? Thanks.</p>