Joined: Tue Apr 12, 2005 5:44 pm Posts: 1
|
[b]Hibernate version: 2.1.8
[b]Mapping documents: attached
[b]Name and version of the database you are using: oracle
I have concreteClass1 and concreteClass2 which are inherited from baseClass. I am using hibernate "One table per concrete class" inheritance model.
I have created total TWO TABLES,
one table for concreteClass1 --> concreteTable1 and
another table for concreteClass2 ---> concreteTable2
I have otherClass which contains COLLECTION(set) OF baseClasses(combination of concreteClass1 and concreteClass2). I am not sure how to write the mapping for this. I appreciate your help
<hibernate-mapping>
<class name="concreteClass1" table="concreteTable1" polymorphism="implicit">
<id name="id" column="CLASS1_ID" type="long">
<generator class="native">
<param name="sequence">seq1</param>
</generator>
</id>
<property name="concreteClassType" column="concrete_Class_Type_1" type="string"/>
.....other properties......
</class>
<class name="concreteClass2" table="concreteTable2" polymorphism="implicit">
<id name="id" column="CLASS2_ID" type="long">
<generator class="native">
<param name="sequence">seq1</param>
</generator>
</id>
<property name="concreteClassType" column="concrete_Class_Type_2" type="string"/>
.....other properties......
</class>
</hibernate-mapping>
<hibernate-mapping>
<class name="otherClass" table="otherClasstable">
<id name="id" column="other_class_id" type="long">
<generator class="native">
<param name="sequence">seq2</param>
</generator>
</id>
<!-- How to get set here instead of single entity--->
<any name="estate"
meta-type="string"
id-type="java.lang.Long">
<meta-value value="CLASS_1" class="concreteClass1"/>
<meta-value value="CLASS_1" class="concreteClass2"/>
<column name="REF_TYPE"/>
<column name="REF_ID"/>
</any>
....other properties...
</class>
</hibernate-mapping>
|
|