adspace
How to integrate spring with hibernate using annotations?
Answer Posted / Atul Yadav
To integrate Spring and Hibernate using annotations, you should:
1. Add Hibernate dependencies to your project.
2. Configure a DataSource or JPA provider in your Spring configuration file or Java Configuration class.
3. Define the Hibernate session factory bean in your Spring configuration file or use @EnableTransactionManagement and @Autowired the session factory if you are using annotations.
4. Annotate your DAO classes with @Repository, your service classes with @Service, and your controller classes with @Controller.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers