A discriminator column stores the concrete subtype represented by each row in a single-table inheritance mapping. A value such as `CC` identifies a `CreditCard` row among shared superclass and subclass columns. section 7.3
BillingDetails hierarchy
A JPA mapping declares `@Inheritance(strategy = InheritanceType.SINGLE_TABLE)` and `@DiscriminatorColumn(name = "BD_TYPE")` on `BillingDetails`; `CreditCard` supplies `@DiscriminatorValue("CC")`. Polymorphic queries read the hierarchy, while `CreditCard` queries add `where BD_TYPE='CC'`.
Using a discriminator column provides these practical tradeoffs:
- Keeps polymorphic and non-polymorphic queries simple and performant, and supports straightforward ad hoc reporting without complex joins or unions. section 7.3
- Requires subclass-specific columns to be nullable, so the database may not enforce required properties such as a credit-card expiration date. section 7.3
- Does not make an abstract embeddable property polymorphic; without discrimination, a JPA provider cannot decide which concrete embeddable to load. section 7.6
