Spring / Spring Data Access
Difference between HibernateTransactionManager and JpaTransactionManager.
It is about making your code depend on either JPA or Hibernate when using Hibernate or JPA transaction manager.
javax.persistence.EntityManager is a JPA (Java EE) standard interface, while org.hibernate.SessionFactory is a Hibernate proprietary interface. Using EntityManager instead of SessionFactory makes your classes not depend on Hibernate.
Using the JPA-way instead of the Hibernate-way is considered as best practice. JPA way will still depend on Hibernate as the JPA provider, however, when you want to change to another JPA provider, it will be easy.
JPA-interfaces are considered more stable than the Hibernate.
More Related questions...