title: Spring TransactionTemplate and commit
body: <p>I have to update status of a variable in database before processing it for ensuring only one thread process it.</p>
  
  <p>For this I am using <code>spring's transactionTemplate</code>
  so my doubt is:
  If I have something like:</p>
  
  <pre><code>
  
      TransactionTemplate(new TransactionCallback()){
           execute(){
              try{
                query 1 - having select for update
                query 2 - having update
              } catch(Exception e){
                TransactionStatus.setRollBackOnly();
                throw e;
              }
           }
      }
  
  </code></pre>
  
  <p>I use spring's <code>jdbctemplate</code> with <code>autocommit on</code>.</p>
  
  <p>How many commits happen? 
  Does commit happen for every query? 
  Is this good way to achieve synchronization?</p>