O'Reilly logo

Spring Persistence with Hibernate by Ahmad Seddighi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Mapping inheritance hierarchy

An entity class may be derived from another entity class. Although the subclass has its own properties and associations, it also inherits the superclass properties and associations. As a result, to persist a subclass object, we need to persist its own properties and associations, as well as those it inherits. The persisting should occur in a way that allows reconstruction of the original object later.

Databases, however, do not naturally provide a solution for persisting inheritance hierarchies. Therefore, each application may use its own solution for this purpose.

Let's continue our discussion with a simple example. The following figure shows a class diagram of an inheritance hierarchy with the Person, Student, and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required