04 - Spring Boot with JPA and H2
springboot
JPA
H2
Repositories
Inheritance
Extra information regarding persistence in JPA
Introduction
This entry extends the material explained in the previous post about persisting entities in H2 using JPA and Spring Boot. Here we’ll talk about persisting classes with inheritance as well as coupling with other classes.
Types of inheritance strategies in JPA
Thorben Janssen does a very good job at explaining the differences between each JPA inheritance strategy in this article.
Also, check this Baeldung article defining some tips on how to map an inheritance hierarchy to a single table.
Table per Class strategy
Check the following video for a quick example:
Single Table strategy
Check the following video for a quick example: