title: When is JDBC transaction opened within JTA transaction?
body: <p>Considering a use of JPA inside a Java EE container (or Spring container): </p>
  
  <p>Is it right to say that a main difference between JTA and Resource-local transaction is (except concept of first-level caching managed by container using JTA):</p>
  
  <p>JTA opens a JDBC transaction only as soon as entityManager flushes one or more entities and closes it when commit is executed (manually or at the end of transactional method).</p>
  
  <p>Whereas a block of code within a Resource-local transaction opens a JDBC transaction as soon as a first operation is sent to the database. There is no concept of persistence delay in order to optimize access to datatabase' like JTA does.</p>