title: Hibernate FlushMode is set to Manual for multiple transactions
body: <p>Here is my code :</p>
  
  <pre><code>HibernateUtil.pushFlushMode(FlushMode.MANUAL);
  getCurrSess().beginTransaction();
  try {
      for(i=0; i&lt;list.size(); i++) {
          Obj dummy = list.get(i);
          // Here Multiple things can happen like selects, save, update and deletes of different objects which are related to dummy object....
          if (i &gt; 0 &amp;&amp; (i % 10 == 0)) {
              getCurrSess().getTran().commit();
              getCurrSess().beginTransaction();
              if (i % BATCH_SIZE == 0) {
                  getCurrSess().flush();
                  Thread.sleep(20);
              }
          }
      } 
  } catch(Exception e) {
      getCurrSess().getTran().rollback();
  } finally {
      HibernateUtil.popFlushMode();
  }
  </code></pre>
  
  <p>Flush happens for every 10 committed transaction(i=100). This is part of a background job which takes up lots of processing. Number of objects vary around 20,000 and I cannot clear the session until the whole process is finished because I end up in Lazy initialization exception. My code works fine but here I'm bothered about the sequence of flush and commit in manual mode. Can this be done in a better way ?</p>