未经测试 ,但根据您发布的链接,如果您使用的是hibernate3 <休眠映射> < class name =Atable =A> < id name =idtype =longcolumn =a_id> < generator class =native/> < / id> < discriminator column =discriminator_coltype =string/> < property name =type =/> <! - ... - > < / class> < subclass name =Bextends =Adiscriminator-value =B> <! - ... - > < / subclass> < subclass name =Dextends =Bdiscriminator-value =D> <! - ... - > < / subclass> < subclass name =Cextends =Adiscriminator-value =C> <! - ... - > < / subclass> < / hibernate-mapping> Currently I have a structure like this:A|+--B|+--CIt's mapped with one table per subclass using joined tables. For historic reasons I also use a discriminator, so the current situation is as described in Section 9.1.3 of the Hibernate manual.Question: How do I extend the mapping for a structure like this:A|+--B| || D|+--CCan I <subclass> a <subclass> in the hibernate mapping? What <key>s do I need? 解决方案 not tested but, according to the link you posted if you are using hibernate3<hibernate-mapping> <class name="A" table="A"> <id name="id" type="long" column="a_id"> <generator class="native"/> </id> <discriminator column="discriminator_col" type="string"/> <property name="" type=""/> <!-- ... --> </class> <subclass name="B" extends="A" discriminator-value="B"> <!-- ... --> </subclass> <subclass name="D" extends="B" discriminator-value="D"> <!-- ... --> </subclass> <subclass name="C" extends="A" discriminator-value="C"> <!-- ... --> </subclass></hibernate-mapping> 这篇关于在Hibernate中映射多级继承的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-18 22:08