March 2015
Intermediate to advanced
284 pages
6h 13m
English
CHAPTER 4
![]()
Inheritance and Custom Mapping
Inheritance, polymorphic associations, and polymorphic queries are supported by entities. The JPA specification says that both concrete and abstract classes can be entities and can be mapped with the Entity annotation. Non-entity classes and entity classes can extend each other. Hibernate provides the MappedSuperclass annotation (@MappedSuperclass) to enable inheritance mapping and to let you map abstract or concrete entity subclasses. The mapped superclass doesn’t necessarily have its own separate table.
Hibernate provides four strategies for mapping an inheritance hierarchy:
Read now
Unlock full access