Spring Boot MySQL Database Setup with JPA | Chapter #2

Опубликовано: 15 Март 2022
на канале: Genuine Coder
10,577
148

In this tutorial, we will explore how to use the spring boot CRUD repository to easily create, retrieve, update and delete database objects. First, we will add a new database Entity model and set up an auto-incremented integer primary key for the model. In Spring JPA, you can add @Entity annotation to mark a class as a database entity. It will then be automatically taken by the Spring JPA and a database table will be created for the same.

Then, we will create a CRUD repository by extending org.springframework.data.repository.CrudRepository and use it in a DAO (Data Access Object) class. Spring boot CRUD provides many functions that can be used directly without having to write any code. For example, the save(T entity) function saves an entity model to the database, and we don't have to write any special code to do that.

After setting up the CRUD Repository and the DAO class, we will write a unit test to make sure that the repository is indeed working as expected.

You can find this project in GitHub at https://github.com/afsalashyana/Sprin...
Genuine Coder Blog: https://www.genuinecoder.com/

Tags: #Java #SpringBoot

Introduction: (0:00)
Create new Employee JPA Entity: (01:01)
Configure Spring Boot Component Scan: (05:55)
Create new CRUD Repository: (09:36)
Setting up DAO (Data Access Object): (12:02)
Test the repository: (18:13)


Смотрите видео Spring Boot MySQL Database Setup with JPA | Chapter #2 онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Genuine Coder 15 Март 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 10,577 раз и оно понравилось 148 людям.