This tutorial will walk you through the steps of mapping a JPA/Hibernate One-to-Many bidirectional relationship with Spring Boot, Spring Data JPA, Lombok, H2 and Swagger. The following table relationship diagram illustrates the database designed in this solution:
One-to-many relationship refers to the relationship between two entities/tables A and B in which one element/row of A may be linked with many elements of B, but a member of B is linked to only one element of A.
In this example, the book_category and book tables have a one-to-many relationship. One category may be linked with many books but one book is linked to only one category.
mvn package && java -jar target/bookManager.jar
Database UI http://localhost:8080/h2/
Swagger UI http://localhost:8080/swagger-ui.html