How to integrate spring with hibernate using annotations?
Answer / 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 |
What is difference between @component and @controller?
Why do we need spring batch?
What is a spring ioc container?
Can we learn spring boot without knowing spring? : Spring Boot
What is a spring component?
What do you understand as dependency injection (di)?
What is the default bean scope within spring?
How many types of dependency injection are there in spring?
What is the difference between @qualifier and @primary?
What is tasklet in spring batch?
How do you write an annotation?
Differentiate between beanfactory and applicationcontext.