title: Transactions in Enterprise level application
body: <p>I am trying to understand the transactions, and more specifically i am doing it using Spring framework. Going through the material that i have (both internet and books), i see these terminologies:</p>
  
  <ol>
  <li>Container managed transactions (CMT).</li>
  <li>Bean Managed transactions (BMT).</li>
  <li>Java transaction API (JTA).</li>
  </ol>
  
  <p>Also, for a large enterprise level application, terminologies like "local" and "global" transactions too i have encountered.</p>
  
  <p>What i have understood, is that global transactions is for the cases in which we are managing two or more different resouces (like One Oracle DB, other MySQL etc) and commits/rollback to them happen if both are success/failure. Local transactions is for when we have only one resource to manage (like only one DB connection to MySQL).</p>
  
  <p>I have following doubts:</p>
  
  <ol>
  <li><p>While writing a simple JDBC standalone program, we can code to commit/rollback. I believe this is example of local transaction, is this correct? And is this transaction taken care by "JDBC" library itself or the drivers?</p></li>
  <li><p>What is CMT? What i understand is that Container takes care of the transaction management (like Jboss AS). If this is correct, how internally does it manages? Are CMT local or global? Do they use JDBC API's internally to manage the transactions?</p></li>
  <li><p>What is BMT? This i am not able to understand. We can have application deployed in an App server (and i believe in those cases the transaction would be managed by Container) or i can write an standalone application in which i can use the transaction management code myself (try .. catch block etc). So, which category BMT falls?</p></li>
  <li><p>While reading Spring framework, i read that Spring framework have its own way of managing the transaction. Down the line, i read Spring Framework uses JTA to manage transactions? I am confused about this. If JTA is API, do we have multiple vendors who implement JTA (like for JPA, we can have multiple vendors who provide the implementation e.g. Hibernate).</p></li>
  <li><p>Is JTA for local or global transactions? When i write a simple JDBC program to manage transaction, does it use API's which comply JTA? Or is JTA totally different from transaction management which simple JDBC program uses?</p></li>
  <li><p>Same for CMT, does CMT follow the rules which JTA has in place (the API's primarily)?</p></li>
  </ol>
  
  <p>It would be great if you answer point-wise, i did search on net, my doubts are still not answered.</p>