Recently, my friend Lukas Eder wrote the following message on Twitter:
5. You don't need inheritance. Especially not entity inheritance.—
Lukas Eder 🤔 (@lukaseder) June 01, 2017
Just like in any OOP (Object-Oriented Programming) language, entity inheritance is suitable for varying behavior rather than reusing data structures, for which we could composition. The Domain Model compromising both data (e.g. persisted entities) and behavior (business logic), we can still make use of inheritance for implementing behavioral software design pattern.
In this article, I’m going to demonstrate how to use JPA inheritance as a means to implement the Strategy design pattern.