English 中文(简体)
Why EclipseLink is adding discriminator column for joined inheritance strategy?
原标题:

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 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.

问题回答

暂无回答




相关问题
query must begin with SELECT or FROM: delete [delete

I am using JPA in addition to spring(3.0.0.M4). While deleting multiple records using query.executeUpdate() i am getting the following exception. org.springframework.web.util.NestedServletException: ...

Last update timestamp with JPA

I m playing around a bit with JPA(Eclipselink to be specific). The below entity have a timestamp that s supposed to reflect whenever that entity was last updated. What are the strategies for making ...

@IdClass with non primative @Id

I m trying to add a composite primary key to a class and having a bit of trouble. Here are the classes. class User { private long id; ... } class Token { private User user; private ...

Database not dropped in between unit test

Hello good people i came accross a weird behaviour in my test.I m using JPA hibernate annotation with spring. let say i have an Class MyObject and it s property email is marqued @Column(name="EMAIL", ...

Toplink trying to persist null object

I have an object "Instance" with another object "Course" inside. When trying to persist a new Instance object, I get the following error if Course is null: java.lang.IllegalStateException: During ...

How to prevent JPA from rolling back transaction?

Methods invoked: 1. Struts Action 2. Service class method (annotated by @Transactional) 3. Xfire webservice call Everything including struts (DelegatingActionProxy) and transactions is configured ...

热门标签