本文介绍了为什么EclipseLink为连接继承策略添加鉴别符列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在EclipseLink JPA实现中使用JOINED继承策略.我已经注意到EclipseLink会将区分符列(默认情况下为DTYPE)添加到数据库模式中.我知道,一个表继承策略需要使用鉴别符,但是为什么要使用JOINED策略呢?

I am using 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需要此列,因为删除它后出现错误.是否出于性能原因等原因添加了此列?我对此并不特别满意,因为从数据库架构的角度来看,本专栏只是不必要的混乱.

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的JPA不会做任何类似的事情.

Hibernate based JPA does not do anything similar.

推荐答案

来自联接表继承:

...

discriminator列决定了类型,从而决定了要使用的联接表,因此您需要在父表中有一个discriminator列.

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.

这篇关于为什么EclipseLink为连接继承策略添加鉴别符列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 22:25