Summary of OO hierarchy inheritance mapping strategies

By | August 25, 2016

1. Pre-requisites

Should read first there types of mapping below:

2. Summary mapping strategies

Feature Single-table Joined-tables Table-per-class
Table support One table for all classes in the entity hierarchy: – Mandatory columns may be nullable (exclusive of DiscriminatorColumn). – The table grows when more subclasses are added. One for the parent class, and each subclass has a separate table to store polymorphic properties.Mapped tables are normalized. One table for each concrete class in the entity hierarchy.
Uses discriminator column? Yes Yes No
SQL generated for retrieval of entity hierarchy Simple SELECT SELECT clause joining multiple tables. One SELECT for each subclass or UNION of SELECT.
SQL for insert and update Single INSERT or UPDATE for all entities in the hierarchy Multiple INSERT,UPDATE: one for the root class and one for each involved subclass. One INSERT or UPDATE for every subclass.
Polymorphic relationship Good Good Poor
Polymorphic queries Good Good Poor

Table 1: Summary of OO hierarchy inheritance mapping strategies (source: EJB3 in Action)


  1. D. Pan, R. Rahman, R. Cuprak, M. Remijan, “Mapping inheritance”, In EJB3 in Action,pp.292-293, Manning, Second Edition, 2014

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.