hello
how would be the best way to map multiple inheritance using interfaces in hibernate? i've read many discussions (here and googled) but with only partial answers i can't use to create a working example.
Imagine:
Code:
interface FooAble {
get/setFooProp1
get/setFooProp2
}
interface BarAble {
get/setBarProp1
get/setBarProp2
}
class Poor {
get/setPoorProp1
get/setPoorProp2
}
class FooMaster implements FooAble {
get/setFooProp1
get/setFooProp2
get/setFooMasterProp1
get/setFooMasterProp2
}
class BarMaster implements BarAble {
get/setBarProp1
get/setBarProp2
get/setBarMasterProp1
get/setBarMasterProp2
}
class FooBarMaster implements FooAble, BarAble {
get/setFooProp1
get/setFooProp2
get/setBarProp1
get/setBarProp2
get/setFooBarMasterProp1
get/setFooBarMasterProp2
}
In the DB there would be these tables:
FOOABLE, BARABLE, POOR, FOOMASTER, BARMASTER, FOOBARMASTER
If I needed to fetch a FooMaster instance, the hibernate would do:
SELECT ... FROM FOOABLE JOIN FOOMASTER
If I needed to fetch a FooBarMaster instance, the hibernate would do:
SELECT ... FROM FOOABLE JOIN BARABLE JOIN FOOBARMASTER
Is something like that possible in Hibernate 3? If not, what would be the bes approach? (please example with .hbm.xml mappings too). I think many hibernate users would like to see clear answer how to best solve this problem (please put it then to the FAQ too).
Many thanks in advance.