DEV Community

loizenai
loizenai

Posted on

Spring JPA/Hibernate One-to-Many Association + PostgreSQL | SpringBoot CRUD RestAPIs

https://grokonez.com/spring-framework/spring-boot/spring-jpa-hibernate-one-to-many-association-postgresql-springboot-crud-restapis-post-get-put-delete-example

Spring JPA/Hibernate One-to-Many Association + PostgreSQL | SpringBoot CRUD RestAPIs Post/Get/Put/Delete example

In the tutorial, we show how to expose CRUD RestAPIs Post/Get/Put/Delete to interact with Hibernate Spring JPA One-to-Many association models using SpringBoot and PostgreSQL database.

Previous post:

Related articles:
Spring JPA – Many to Many relationship
How to configure Spring JPA One to One Relationship – SpringBoot
Spring Data Rest – JPA One-to-Many relational entities | SpringBoot + MySql + HAL Browser
Kotlin SpringJPA Hibernate One-To-Many relationship

Related pages:

Technologies

  • Java 8
  • Maven 3.5.4
  • SpringToolSuite version 3.9.4.RELEASE
  • SpringBoot 2.0.4.RELEASE

Demo

Overview

We have 2 models Student & Assignment with One-to-Many association relationship:

jpa-hibernate-one-to-many-spring-boot-rest-apis-spring-jpa-one-to-many-postgresql-association-relationship

We create a SpringBoot project as below:

jpa-hibernate-one-to-many-spring-boot-rest-apis-spring-jpa-one-to-many-postgresql-architecture

jpa-hibernate-one-to-many-spring-boot-rest-apis-spring-jpa-one-to-many-postgresql-project-structure

Hibernate JPA configuration for 2 models Student & Assignment:

More at:

https://grokonez.com/spring-framework/spring-boot/spring-jpa-hibernate-one-to-many-association-postgresql-springboot-crud-restapis-post-get-put-delete-example

Spring JPA/Hibernate One-to-Many Association + PostgreSQL | SpringBoot CRUD RestAPIs Post/Get/Put/Delete example

Top comments (0)