title: JPA's EntityManager or Hibernate's HibernateTemplate with Spring
body: <p>I have decided to use Spring, Hibernate, and Restlet to create a web service. I am new to all of these three technologies. My question is this: How do I decide whether to use JPA's <code>EntityManager</code> or Hibernate's <code>HibernateTemplate</code>? </p>
  
  <p>Code snippet for JPA's EntityManager:</p>
  
  <pre><code>protected EntityManager entityManager;
  
  @PersistenceContext
  public void setEngityManager(EntityManager entityManger) {
      this.entityManager = entityManager;
  }
  </code></pre>
  
  <p>Code snippet for Hibernate's HibernateTemplate:</p>
  
  <pre><code>private SessionFactory sessionFactory;
  private HibernateTemplate hibernateTemplate;
  
  @Autowired
  public void setSessionFactory(SessionFactory sessionFactory) {
      this.sessionFactory = sessionFactory;
      this.hibernateTemplate = new HibernateTemplate(sessionFactory);
  }
  </code></pre>