From the course: Java Persistence API (JPA): 2 Inheritance and Querying

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Joined table

Joined table

From the course: Java Persistence API (JPA): 2 Inheritance and Querying

Start my 1-month free trial

Joined table

- [Instructor] The final inheritance mapping strategy is joined table. The pros and cons of this strategy are important so that you know when, or when not to use it for a particular use case. Entities can inherit from other entities. This is the case for the joined table inheritance mapping strategy. Let's discuss it in more detail. Going back to our object hierarchy, for this use case let's say we want to persist a ticket entity in the database, and also its subclasses, Enhancement and Bug. As we saw before, storing tickets allows us to query higher level tickets when the need arises. When using the joined table strategy, each class of the inheritance hierarchy is mapped to its own database table. This sounds similar to the table per class strategy, but this time the subclasses do not hold the inherited fields. When using the joined table strategy, the parent class ticket table contains its columns and the subclasses are much smaller, because they only contain their specific fields…

Contents