Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Joined Inheritance, Discriminator Column, and Cross-Provider Compatibility

I would like to open a topic for discussion on the Eclipselink User forums regarding Eclipselink’s requirement for a discriminator column with joined strategy inheritance.  

The JPA 2.1 Specification makes the following statements:

----------

11.1.12 DiscriminatorColumn Annotation

For the SINGLE_TABLE mapping strategy, and typically also for the JOINED strategy, the persistence provider will use a type discriminator column. The DiscriminatorColumn annotation is used to define the discriminator column for the SINGLE_TABLE and JOINED inheritance mapping strategies.

and

11.2.2.7 DiscriminatorColumn

A discriminator column is generated for the SINGLE_TABLE mapping strategy and may optionally be generated by the provider for use with the JOINED inheritance strategy. The DiscriminatorColumn annotation may be used to control the mapping of the discriminator column. See section 11.1.12 for the rules that pertain to discriminator columns. 

----------

The language in the specification suggests that whether to require a discriminator column for joined strategy inheritance is up to the provider implementor.  Eclipselink’s documentation is pretty clear about it being required (http://wiki.eclipse.org/EclipseLink/Examples/JPA/Inheritance)  Other providers such as OpenJPA and Hibernate (http://stackoverflow.com/questions/2063515/why-eclipselink-is-adding-discriminator-column-for-joined-inheritance-strategy) can live without the discriminator column.

The discussion I want to initiate is not whether Eclipselink is wrong to require this (clearly it’s not given the Spec’s language), but whether Eclipselink should be enhanced to permit its absence in the interest of making migration from these other providers to Eclipselink easier, and to gauge developer community support for this enhancement.

Back to the top