Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The parent persists data by inserting instead of updating when using InheritanceType.JOINED because JOINED inheritance strategy maps multiple tables to a single entity class hierarchy. Each subclass is mapped to its own table, and the parent class is mapped to a table containing only the shared attributes between all subclasses. When a new entity is inserted into a subclass table, the corresponding parent entity is also inserted into the parent table with the shared attributes. Updating a parent entity would require updating potentially all of the child tables which can be inefficient and cause performance issues. Therefore, whenever a new entity is persisted, a new row is inserted into both the parent and the child tables.