Why does EclipseLink add a discriminator column for a shared inheritance strategy?

I am using JOINED inheritance strategy with JPA implementation of EclipseLink. I noticed that EclipseLink adds the discriminator column, named DTYPE by default, to the database schema. I understand that discriminator is necessary for one table inheritance strategy, but why for the JOINED strategy?

EclipseLink needs this column because I have errors after deleting it. Is this column added for performance reasons, etc.? This is not particularly pleasing to me, because from the point of view of the database schema, this column is just an extra mess.

Hibernated JPA does nothing of the sort.

+6
jpa eclipselink
source share
1 answer

From Inheritance to inherited inheritance :

In unified table inheritance, each class shares data from the root table. In addition, each subclass defines its own table, which adds its extended state. The following example shows two tables, PROJECT and L_PROJECT, as well as two classes, Project and LargeProject:

...

The discriminator column is what determines the type and therefore what is used in the joined table, so you need the discriminator column in the parent table.

+1
source share

All Articles