Hi all,
i'm trying to map following object tree with table per class hierarchy
AND Joined subclasses strategy, but i always get table per class
hierarchy
Code:
A(name) -> B1(name)
-> B2(name)
-> B3(name) -> C1(ref)
-> C2(type)
so i defined my classes as :
Code:
@Entity
@DiscriminatorColumn(
name="access_type",discriminatorType=DiscriminatorType.STRING
)
@DiscriminatorValue("a-type")
@Table(name="a")
public abstract class A { ... }
B1 and B2 are straight forward:
Code:
@Entity
@DiscriminatorValue("b1")
public class B1 extends A { ... }
@Entity
@DiscriminatorValue("b2")
public class B2 extends A { ... }
as i want to have separate tables for C1 and C2
i add @Inheritance(strategy=InheritanceType.JOINED)
to my B3 object
Code:
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public abstract class B3 extends A { ... }
C1 and C2 then extend from B3
Code:
@Entity
public abstract class C1 extends B3 { ... }
@Entity
public abstract class C2 extends B3 { ... }
When i test this i always get a single table for both hierarchies (B and C)
because the discriminator is inherited from the base class A.
Is there a way i can save my C objects in separate tables?
After reading the documentation i'm wondering whether i should use a @SecondaryTable, or a @OneToOne, or even @MappedSuperclass
I'd appreciate any hint :)
Thank you!
g,
kris
Hibernate version:
3.2.1.ga
Name and version of the database you are using:
HSQLDB 1.8.0.7