title: Difference between save() and commit() in a database while using hibernate
body: <p>I came across this example from a book while learning about the Hibernate framework.</p>
  
  <pre><code>public class BasicMovieManager()
  {
      private void persistMovie(Movie movie)
      {
          Session session=sessionFactory.getCurrentSession();
          session.beginTransaction();
          session.save(movie);
          session.getTransaction().commit();
      }
  }
  </code></pre>
  
  <p>I can understand that the Movie object has to be mapped and written to the database. I also understand that the commit step will write to the database. But what is the purpose of <code>save()</code> here? A few sources I referred say that <code>save()</code> <em>persists</em> the data. Doesn't persist mean writing to a permanent storage? If not,what exactly does it mean? </p>