[hibernate-issues] [Hibernate-JIRA] Created: (HHH-7181) Mixing inheritance strategy in a entity hierarchy is not allowed message for JOINED + SINGLE_TABLE
Pim van Dongen (JIRA)
noreply at atlassian.com
Fri Mar 16 12:28:48 EDT 2012
Mixing inheritance strategy in a entity hierarchy is not allowed message for JOINED + SINGLE_TABLE
--------------------------------------------------------------------------------------------------
Key: HHH-7181
URL: https://hibernate.onjira.com/browse/HHH-7181
Project: Hibernate ORM
Issue Type: New Feature
Components: metamodel
Affects Versions: 4.0.0.CR5
Environment: Hibernate 4.0.0.CR5 (annotations 4.0.0.CR2), HSQLDB 2.2.6
Reporter: Pim van Dongen
Priority: Minor
Attachments: JSTNoWarning.txt
When mixing inheritance strategies in a single entity hierarchy like the following:
A with @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
B extends A
C extends A with @Inheritance(strategy=InheritanceType.JOINED)
D extends C
E extends C
The following warning is given by Hibernate:
WARN: HHH000138: Mixing inheritance strategy in a entity hierarchy is not allowed, ignoring sub strategy in: com.example.C
However, when I reverse this,
A with @Inheritance(strategy=InheritanceType.JOINED)
B extends A
C extends A with @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
D extends C
E extends C
Hibernate does NOT give me a warning. Looking at the database reveals that the tables A, B, C, D and E are made (where only A, B and C should have been created).
"Feature" request: Please give a warning when encountering a mixed inheritance strategy that is not supported by Hibernate, such as JOINED + SINGLE_TABLE.
I've attached some files (one file listing all teh codez) that I used when encountering the issue, namely the classes A through E, and some testing code.
I did not provide a testcase because I don't know of an exact testcase that could be used to reproduce the issue that it doesn't make the tables properly AND doesn't display a warning.
I did provide a method which you can run through debug, during which you can examine the database or logs to see that the tables haven't been made properly. Combine it with console output, and there you go.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list