High-Performance Java Persistence – Chapter 12 – Inheritance

Are you struggling with performance issues in your Spring, Jakarta EE, or Java EE application?

Imagine having a tool that could automatically detect performance issues in your JPA and Hibernate data access layer long before pushing a problematic change into production!

With the widespread adoption of AI agents generating code in a heartbeat, having such a tool that can watch your back and prevent performance issues during development, long before they affect production systems, can save your company a lot of money and make you a hero!

Hypersistence Optimizer is that tool, and it works with Spring Boot, Spring Framework, Jakarta EE, Java EE, Quarkus, Micronaut, or Play Framework.

So, rather than allowing performance issues to annoy your customers, you are better off preventing those issues using Hypersistence Optimizer and enjoying spending your time on the things that you love!

Part 2, Chapter 12

Every new chapter of my book is released right after it’s being completed, so the reader doesn’t have to wait for the whole part to be finished to get access to new material.

Table of content

This chapter explains JPA inheritance from a data access performance point of view.

12. Inheritance
12.1 Single table 
12.2 Join table 
12.3 Table-per-class 
12.4 Mapped superclass 

Chapter summary

Inheritance is undoubtedly the most obvious impedance mismatch between an object-oriented domain model and a relational database schema. This chapter explains the benefits of entity inheritance and its inherent trade-offs.

As a rule of thumb, inheritance should be used with care.

Most often, when polymorphic queries and associations are needed, the choice is between single table and joined table, each one having pluses and minuses. Table-per-class can generate statements that are way too complex, and if entity polymorphism is not needed, the @MappedSuperclass might be a better alternative anyway.

Transactions and Concurrency Control eBook

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.