title: Question about Hibernate session.flush()
body: <p>I want to inquire about what actually the flush method does in the following case:</p>
  
  <pre><code>for (int i = 0; i &lt; myList.size(); i++) {
      Car c = new Car( car.get(i).getId(),car.get(i).getName() );
      getCurrentSession().save(c);
      if (i % 20 == 0)
          getCurrentSession().flush();
  }
  </code></pre>
  
  <p>Does this means that after the iteration 20, the cache is flushed, and then the 20 held memory objects are actually saved in the database ?</p>
  
  <p>Can someone please explain to me what will happen when the condition is true.</p>