How to fetch data from database in spring mvc using hibernate?



How to fetch data from database in spring mvc using hibernate?..

Answer / Ravendra Singh Pundhir

To fetch data from a database in Spring MVC using Hibernate, you would typically do the following: 1) Inject SessionFactory or Session into your service layer. 2) Create a session and start a transaction. 3) Write Hibernate queries to fetch data and set the result to a model object. 4) Commit the transaction and close the session.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Hibernate Interview Questions

Why hibernate is required?

1 Answers  


What are the best practices that hibernate recommends for persistent classes.

1 Answers  


What are the hibernate annotations?

1 Answers  


What are the important interfaces in hibernate?

1 Answers  


What is dialect in hibernate?

1 Answers  


What is a one to one function example?

1 Answers  


What is query level cache in hibernate?

1 Answers  


Why jpa is better than hibernate?

1 Answers  


What is the difference between sessionfactory and session in hibernate?

1 Answers  


What are different orm tools?

1 Answers  


What is transient state in hibernate ?

1 Answers  


What is latest hibernate version?

0 Answers  


Categories