]
Cédric Dupui commented on HHH-5308:
-----------------------------------
Hi all,
Is there a workaround for this bug ?
Tkx
hibernate cannot handle Inheritance, if the discriminatorColumn is
part of a composite pk in a @MappedSupperclass
-----------------------------------------------------------------------------------------------------------------
Key: HHH-5308
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5308
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.2
Environment: Linux, Java 6
Reporter: AndyW
Attachments: jpatest_hibernate_aktuell.zip
Hi,
i am having the following mapping structure
@MappedSuperclass
LadeeinheitEinausgaenge
| @Entity
| @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
| @DiscriminatorColumn(name = "LAEA_TYP")
| @Table(name = "LADEEINHEIT_EINAUS")
+- AbstractEinAusgang
| | @DiscriminatorValue("AUSGANG")
| | @Entity
| +- LadeeinheitAusgaenge
| | @DiscriminatorValue("EINGANG")
| | @Entity
| +- LadeeinheitEingaenge
The composite pk is defined in the MappedSuperclass. The discriminator column
is part of the composite pk. when i start my app, i am getting the following error:
> Repeated column in mapping for entity:
de.dbsystel.gate.integration.model.LadeeinheitAusgaenge column: LAEA_TYP (should be mapped
with insert="false" update="false")
the error message is kind of misleading, because the @DiscriminatorColumn annotation only
defines which column to use for the mapping, i guess. however the actual mapping is
defined in the MappedSuperclass.
When moving the @DiscriminatorColumn to the mappedSuperclass, hibernate does not complain
when starting,
but then it creates tables, it create the default DiscriminatorColumn named DTYPE, which
is not wanted, because i explicitly defined a discriminator column. If the discriminator
column is defined in the mappedSuperclass then it will be ignore. if it is defined in my
abstract base entity. then i get the error mentioned above.
My Intention is to query the AbstractEinAusgang and get one of the two possible concrete
classes, that are defined via the discriminator value.
i have attached the testcase that shows the problem.
cheers,
andy
--
This message is automatically generated by JIRA.
For more information on JIRA, see: