How it works...

This recipe is obviously under the Spring MVC module which is concerned with the implementation and performance of DAO layers in an application. Spring 5 totally supports the Hibernate ORM framework, but only version 5.x. There is no means for Spring 5 to inject SessionFactory and the transaction manager like in the previous Hibernate versions.

To successfully use Hibernate 5, it is advisable to turn off JpaRepositoriesAutoConfiguration since it is part of the JPA autoconfiguration process during Bootstrap. This allows us to implement transaction management from Hibernate 5 when applying the @Repository annotation instead of the default JPA framework of Spring Boot 2.0.

Since the autoconfiguration for JPA is required to be disabled, the bean objects of these Hibernate 5 APIs, namely HibernateTransactionManager, HibernateTemplate, and LocalSessionFactoryBean, must be explicitly injected to the container. Together with the Hibernate properties declared in the application.properties file, these beans will be consumed in order to configure the SessionFactory needed to build and execute the Hibernate Query Language (HQL).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.212.71