title: JPA and transactions in JTA mode (begin and commit)
body: <p>I have practiced <strong>JTA</strong> and <strong>RESOURCE_LOCAL</strong> modes with JPA, there is a huge difference between those two modes. </p>
  
  <p>When I use <strong>RESOURCE_LOCAL</strong>, I have to manage transactions myself with <em>EntityTransaction</em>, and when I use <strong>JTA</strong> it's implicitely done by the application server. </p>
  
  <p>So I would like to know when the <em>begin()</em> and <em>commit()</em> methods are executed in JTA mode. </p>
  
  <p>I assume that when the application server receive a HTTP request it executes "<em>begin()</em>", and before sending an HTTP response to client it executes "<em>commit()</em>"; also, if an error happens before sending the response, it does a "<em>rollback()</em>". Am I right ?</p>