HibernateTransactionManager or JpaTransactionManager

He wants your code to be dependent on JPA, instead of Hibernate. javax.persistence.EntityManager is a JPA (Java EE) standard interface, while org.hibernate.SessionFactory is a Hibernate propertary interface. Moving from SessionFactory to EntityManager makes your classes no longer dependent on Hibernate. Using the JPA-way instead of the Hibernate-way is considered best practice by most people today.

Please note that your system is still dependent upon Hibernate, as you need a JPA provider. But if you want to change to another JPA provider in the future it should be pretty straight forward. Another advantage for going for JPA is that the JPA-interfaces are more stable than the Hibernate ones.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)