Inheritance
Jimmer supports entity inheritance without giving up its immutable object model, typed query DSL, fetchers, DTO language, or save commands.
Two relational mapping strategies are available:
SINGLE_TABLEstores the whole hierarchy in one table.JOINEDstores common properties in the root table and properties declared by derived entity types in additional tables.
Both strategies use a discriminator column in the root table. A root query materializes the actual entity subtype automatically, and mutations keep the discriminator and all physical tables consistent.
This section covers:
- Declaring the hierarchy and choosing a mapping strategy
- Polymorphic queries, fetchers, and type operations
- Save commands, update/delete statements, and type changes
- Polymorphic DTOs and inputs
info
This feature is entity inheritance. @MappedSuperclass
remains useful for sharing properties without creating a polymorphic entity
hierarchy.