6

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

Ninja Dude
  • 1,332
  • 4
  • 27
  • 54

2 Answers2

1

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?

ASR4
  • 545
  • 1
  • 8
  • 24
-2

there are two things crudRepository and sessionFactory. try to find out difference between them and also try to read what is JPA and Hibernate.

WSM RWL
  • 47
  • 6