我写了几个类Dictionary(字典类) ,还有几个子类:MaterialDictionary(材料字典),MedicineDictionary(药品类),而且Dictionary还是自包含的。这样的话,我这个自包含的集合set是放在每个具体的子类中,还是放在父类中即可,放在父类中的话属性会不会丢失。<hibernate-mapping package="net.greatsoft.nccm.model.compensation">
<class name="Dict" abstract="true">
<id name="dictId" column="DICTIONARYID" type="long">
<generator class="sequence">
<param name="sequence">SEQUENCE_DICTIONARYID</param>
</generator>
</id>
<property name="name" column="NAME" length="100" not-null="false" 
type="string"/>
<set name="subDicts" inverse="true" lazy="true">
<key column="parentId" />
<one-to-many class="net.greatsoft.nccm.model.compensation.Dict" />
</set>
<many-to-one name="superior" column="parentId"    class="net.greatsoft.nccm.model.compensation.Dict"/>
<!--药品目录-->
<union-subclass name="MedicineDict" table="DICTIONARY_MEDICINE">
<property name="spec" column="SPECIFICATION" length="50" 
not-null="false" type="string"/>
</union-subclass>
<!--服务设施目录-->
<union-subclass name="MaterialDict" table="DICTIONARY_MATERIAL">
<property name="spec" column="SPECIFICATION" length="20" 
not-null="false" type="string"/>
</union-subclass>
</class>
</hibernate-mapping>
<set name="subDicts" inverse="true" lazy="true">
<key column="parentId" />
<one-to-many class="net.greatsoft.nccm.model.compensation.Dict" />
</set>
这里的set是放在这呢,还是应该放在每个union-subclass里