JPA relationships
In this section, we will introduce JPA relationships, starting with a single database table, and then adding more entities and working with relationships between them. We will build OneToMany and ManyToOne relationships, both unidirectional and bidirectional. Additionally, we will look at how these relationships affect serialization to JSON, and how to avoid recursive structures using annotations or Data Transfer Objects (DTOs).
Before class
warning
Make sure you have at least completed exercises 01-04 from the previous section before starting this one.
Practical requirements
Recommended reading and videos
- Read chapter 4-5 + chapter 7 of the Spring Data JPA guide: 📄 Spring Data JPA slides (PDF)
Extra resources
During class
We will use these 📄 Spring Data JPA Relationships (PDF) and you will have time to do the exercises.
Demos used in class:
- TBD
After class
Finish the exercises.