There are different approaches to integrating Hibernate with Spring. One of them represents defining Hibernate-related configuration in the XML application context file, and, the other one is based on the usage of appropriate annotations. In this section, you will learn to setup Hibernate with Spring using the annotation method.
In order to setup Hibernate with Spring, one would need to do following:
- Setting up data source information in the application.properties file, which can be found in the src/main/resources folder when working with a Spring Boot application.
- Use annotations to wire LocalSessionFactoryBean into the SessionFactory object within DAO.