Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate and CRUDRepository Spring Boot

I am new to Hibernate and Spring boot. I understand that hibernate is ORM tool so that you can map objects to database and just use save() to save obj into the database automatically. In Spring Boot, I would do something like

public interface CourseRepository extends CrudRepository<Course, String>{
}

and somehow I will get all the CRUD operations like save and findAll etc.

From another tutorial of hibernate, it says that session is required to save the object to the database. However, I don't see any form of sessionfactory or session being implemented in Spring boot and I am still able to do the save and findAll operations etc.

How is this happening and what relations does this have with hibernate? Where exactly should I start to find out more about hibernate, stuff like @OneToMany and basically understand the details of the whole application to database operations in spring boot? Thanks

like image 270
Ninja Dude Avatar asked May 03 '17 10:05

Ninja Dude


1 Answers

Spring Boot takes care of all the session management. Refer to this question for better understanding:

Spring Boot & Spring Data: how are Hibernate Sessions managed?

like image 128
ASR4 Avatar answered Nov 08 '22 11:11

ASR4