DEV Community

loizenai
loizenai

Posted on

Spring JPA Hibernate Many to Many – SpringBoot + PostgreSQL

https://grokonez.com/spring-framework/spring-data/spring-jpa-many-to-many

Spring JPA Hibernate Many to Many – SpringBoot + PostgreSQL

This tutorial will guide you through the steps configuring Many to Many relationship in database with Spring JPA, Spring Boot & PostgreSql.

Related articles:

I. Technology for Many-to-Many relationship tutorial

– Java 1.8
– Maven 3.3.9
– Spring Tool Suite – Version 3.8.1.RELEASE

  • PostgreSQL

II. Overview

1. Many to many database design

student and subject tables have many to many relationship via student_subject table.

many to many relationship database

2. Project structure

Look at Package Explorer to see our project structure:
spring jpa many to many structure of project

3. Step to do

  • Create Spring Boot project
  • Config Datasource and Hibernate for JPA
  • Create models that mapping with Database design.
  • Create JPA repositories
  • Implement client for use
  • Run & Check result

More at:

https://grokonez.com/spring-framework/spring-data/spring-jpa-many-to-many

Spring JPA Hibernate Many to Many – SpringBoot + PostgreSQL

Top comments (0)