Hi, I am not a hibernate newbie, and thanks the hibernate I've built many applications using hibernate.
I need to map a complicated inheritance strategy, and I can't find how should I do it:
Code:
public class A { // mapped to table TB_A with a discriminator
...
}
public class B extends A { // mapped to table TB_B
...
}
public abstract class C extends B { // mapped to table TB_C
...
}
public class D extends C { // mapped to table TB_C
...
}
public class E extends C { // mapped to table TB_C
...
}
when I just use table per subclass with discriminator strategy everything is
okay, but I want to map
C,
D and
E in a table per class hierarchy way.
I use Hibernate 3.2.5 with hbm.xml for mapping this structure.
the best result I've got is when querying
D is:
Code:
select ...
from
TB_A this_
inner join TB_B this1_ on this1_.id = this_.id
inner join TB_C this2_ on this2_.id = this_.id
inner join TB_C this3_ on this3_.id = this_.id
...
well the result is correct but there are to joins for table TB_C in the generated SQL, is there any solution to fix this problem?