Spring with JPA using Hibernate

As we know, JPA is not an implementation; it is the specification for persistence. The Hibernate framework follows all of the specifications, and it also has its own additional features. Using the JPA specification in an application enables us to easily switch the persistence provider later if needed.

To use Hibernate on its own requires SessionFactory, and to use Hibernate with JPA requires EntityManager. We are going to use JPA, and the following is the Spring Java-based Hibernate JPA configuration:

@Configuration@EnableTransactionManagement@PropertySource({ "classpath:persistence-hibernate.properties" })@ComponentScan({ "com.packt.springhighperformance.ch6.bankingapp" })public class PersistenceJPAConfig ...

Get Hands-On High Performance with Spring 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.