The goal of this project is to study the JPA relationships: one-to-one
, one-to-many
/ many-to-one
, and many-to-many
.
I Would Appreciate Your Support: I’m embarking on a writing journey on Medium and I would be grateful for your support. If you enjoy my content, please consider following me. I am committed to following you back, and together we can share our knowledge and experiences on the platform.
- [Medium] Understanding Relationships in JPA: Introduction
- [Medium] Understanding Relationships in JPA: One-to-One with Simple Primary Key
In a terminal and inside spring-data-jpa-relationships
root folder, run the following command
docker-compose up -d
In a terminal and inside spring-data-jpa-relationships
root folder, run the command below
./mvnw clean spring-boot:run
Once the application is running, you can access its Swagger website at http://localhost:8080/swagger-ui.html
In a terminal and inside spring-data-jpa-relationships
root folder, run the following command
./mvnw clean test
[Medium]: Understanding Relationships in JPA: One-to-One with Simple Primary Key
Medium article
Medium article
Medium article
Medium article
Medium article
Medium article
- Postgres
docker exec -it postgres psql -U postgres -d jparelationshipsdb \d persons select * from persons;
Type
exit
to exit
One-to-One
- https://vladmihalcea.com/the-best-way-to-map-a-onetoone-relationship-with-jpa-and-hibernate
- https://www.callicoder.com/hibernate-spring-boot-jpa-one-to-one-mapping-example/
One-to-Many / Many-to-One
- https://vladmihalcea.com/the-best-way-to-map-a-onetomany-association-with-jpa-and-hibernate
- https://www.callicoder.com/hibernate-spring-boot-jpa-one-to-many-mapping-example/
Many-to-Many