开发者

Why EclipseLink is adding discriminator column for joined inheritance strategy?

开发者 https://www.devze.com 2022-12-16 14:36 出处:网络
I am u开发者_如何转开发sing JOINED inheritance strategy with EclipseLink JPA implementation. I have noticed that EclipseLink is adding discriminator column, named by default DTYPE, to the database sch

I am u开发者_如何转开发sing JOINED inheritance strategy with EclipseLink JPA implementation. I have noticed that EclipseLink is adding discriminator column, named by default DTYPE, to the database schema. I understand, that discriminator is needed for one table inheritance strategy, but why for JOINED strategy?

EclipseLink needs this column because I've got errors after removing it. Is this column added for performance reasons, etc? I am not particularly happy about that since from the point of view of database schema this column is just unnecessary clutter.

Hibernate based JPA does not do anything similar.


From Joined Table Inheritance:

In the joined table inheritance, each class shares data from the root table. In addition, each subclass defines its own table that 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 thus what joined table to use so you need a discriminator column in the parent table.

0

精彩评论

暂无评论...
验证码 换一张
取 消