Hi,
I am facing an issue with mixed inheritance. Table per subclass with table per class hierarchy is being used.
Code:
A
|
____ (Table per subclass)
| |
B C
|
___ (Table per class hierarchy)
| |
D E
Class A is the superclass which has class level annotations as
@Entity()
@Table(name = "TABLE_A")
@Inheritance(strategy = InheritanceType.JOINED)
public [b]abstract[/b] class A {
....
}
Annotations for class B are
@Entity
@Table(name = "TABLE_B")
@PrimaryKeyJoinColumn(name = "B_ID", referencedColumnName = "A_ID")
public class B {
....
}
Annotations for class C are
@Entity
@Table(name = "SINGLE_TABLE_C")
@PrimaryKeyJoinColumn(name = "C_ID", referencedColumnName = "A_ID")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="C_TYPE", discriminatorType=DiscriminatorType.INTEGER)
public [b]abstract[/b] class C {
....
}
Annotations for class D are
@Entity
@DiscriminatorValue(value = "1")
public class D {
...
}
Annotations for class E are
@Entity
@DiscriminatorValue(value = "2")
public class E {
...
}
There are 5 tables getting created (TABLE_A, TABLE_B, SINGLE_TABLE_C, D and E) instead of only three (TABLE_A, TABLE_B, SINGLE_TABLE_C).
Can anyone please guide on this
Thanks in advance
[/code]