Skip to content

JavatoDev-com/spring-boot-rest-api-mysql

Repository files navigation

Spring Boot REST API Using JPA, Hibernate, MySQL Tutorial

Spring Boot REST API Using JPA, Hibernate, MySQL Tutorial

In this article, I’m going to explain how we can build a REST API using JPA, Hibernate, and MySQL in Spring Boot.

Here JPA (Java Persistence API) used to access, manage, and persist data between java and relational database while hibernate is doing the ORM(Object Relational Mapping) part.

Technologies Going to Use,

  • Java 1.8
  • Spring Boot: 2.3.4.RELEASE
  • JPA
  • MySQL
  • Lombok
  • Gradle
  • Intellij Idea for IDE

Main topics I’m going to discuss here,

  • Adding Required Dependencies
  • Defining API Endpoints
  • Developing the API
    • Configure MySQL for Spring Boot Application
      • spring.jpa.hibernate.ddl-auto explanation
    • Writing Model Classes
      • Defining Relationships Between Model Classes
      • JPA Cascade Types
      • Using Enum in JPA Model Classes
      • What are JsonBackReference and JsonManagedReference
    • Defining Repository Layer
    • Adding Service Layer
    • Controller Layer to Expose REST API Endpoints
  • Testing API
  • Further Development
  • Moving from MySQL to PostgreSQL in Spring Boot
  • Conclusion

📄 Original Tutorial Spring Boot REST API Using JPA, Hibernate, MySQL Tutorial

Related Articles

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages