title: How does @Transactional influence current session in Hibernate?
body: <p>This is a typical setup used in most DAO:</p>
  
  <pre><code>@Transactional
  @Repository
  public class DAO {
  
     @Autowired
     SessionFactory sessionFactory;
  
     public void save(Entity o) {
         sessionFactory.getCurrentSession().save(o);
     }
  
     public Entity load(int id) {
         return (Entity)sessionFactory.getCurrentSession().get(Entity.class, id);
     }
  
  }
  </code></pre>
  
  <p>I see only <code>getCurrentSession()</code> called, no <code>openSession</code> or <code>close</code>.</p>
  
  <p>So when I return the entity from <code>load</code> it's not in session, lazy collections cant be loaded. Similarily, save seems to always flush!</p>
  
  <p>Does the <code>@Transactional</code> annotation from spring do the magic of opening and closing sessions AND transactions all by itself?</p>