title: What is the relationship between BMT/CMT and an application/container-managed EntityManager?
body: <p>The various partial descriptions of the subject have led me to suspect that BMT is strongly tied to an application-managed EntityManager (and the use of UserTransaction), and that CMT is strongly tied to a container-managed EntityManager.</p>
  
  <p>Can anyone give (or point me to) a clear explanation of how exactly BMT/CMT relates to an application/container-managed EntityManager?</p>
  
  <p>What combinations are allowed between transaction demarcation types and EntityManager management types? </p>
  
  <ul>
  <li>Can I combine an application-managed EntityManager with CMT? </li>
  <li>Can I combine a container-managed EntityManager with BMT?</li>
  </ul>
  
  <p>Also, what is the relationship between UserTransaction and BMT/CMT vs application/container-managed EntityManager?</p>
  
  <ul>
  <li>Can I use UserTransaction together with a container-managed EntityManager?</li>
  <li>Does UserTransaction imply BMT and vice-versa?</li>
  </ul>
  
  <p>EDIT: According to <a href="http://www.byteslounge.com/tutorials/container-vs-application-managed-entitymanager" rel="noreferrer">http://www.byteslounge.com/tutorials/container-vs-application-managed-entitymanager</a> I can combine CMT/BMT with application/container-managed EntityManagers any way I like. That still leaves me with the question about the relationship between UserTransaction and BMT. Does one imply the other?</p>
  
  <p>EDIT: contrary to the link posted above, <a href="http://docs.oracle.com/javaee/6/tutorial/doc/bnbqw.html#bnbra" rel="noreferrer">http://docs.oracle.com/javaee/6/tutorial/doc/bnbqw.html#bnbra</a> claims that "<strong>Application-managed entity managers</strong> don’t automatically propagate the JTA transaction context. Such applications <strong>need to manually</strong> gain access to the JTA transaction manager and <strong>add transaction demarcation information when performing entity operations. The javax.transaction.UserTransaction interface defines methods to begin, commit, and roll back transactions</strong>. Inject an instance of UserTransaction by creating an instance variable annotated with @Resource". To me this sounds like "application-managed entity managers require bean managed transaction demarcations". <strong>Who is right? Oracle or Byteslounge?</strong></p>