[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5308) hibernate cannot handle Inheritance, if the discriminatorColumn is part of a composite pk in a @MappedSupperclass
AndyW (JIRA)
noreply at atlassian.com
Sat Jun 12 05:13:59 EDT 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=37429#action_37429 ]
AndyW commented on HHH-5308:
----------------------------
here is the mapping again, because the display was broken.
{noformat}
@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
{noformat}
> 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.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list