What inheritance strategies does JPA offer, and how does @MappedSuperclass differ?
Short answer
JPA has three ways to store inheritance: SINGLE_TABLE (one shared table), JOINED (one table per class, joined by primary key), TABLE_PER_CLASS. @MappedSuperclass only shares fields and has no parent table.
3 points to say:
SINGLE_TABLEis fastest, but subclass columns must allow null.JOINEDis stricter, but reads need joins.@MappedSuperclassis only Java inheritance.
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.