hello!
following class structrure: two classes 'ReqTest' and 'TRefTest', both subclasses of 'ProjectPersModelWithCreation' (in this example both classes are equal). both classes have a set of 'ModelCoverage' and this class references the superclass 'ProjectPersModelWithCreation':
Code:
<class
name="com.seqis.kltm.model.db.abstracts.ProjectPersModelWithCreation"
table="persistent_model"
>
<id
name="objectId"
column="object_id"
type="long"
>
<generator class="native">
</generator>
</id>
<joined-subclass
name="com.seqis.kltm.model.db.project.ReqTest"
table="req_test"
>
<key
column="object_id"
/>
<property
name="name"
type="java.lang.String"
update="true"
insert="true"
column="name"
/>
<set
name="modelCoverage"
lazy="false"
cascade="save-update"
sort="unsorted"
>
<key
column="referencer_id"
>
</key>
<one-to-many
class="com.seqis.kltm.model.db.project.ModelCoverage"
/>
</set>
</joined-subclass>
<joined-subclass
name="com.seqis.kltm.model.db.project.TRefTest"
table="tref_test">
<key
column="object_id"
/>
<property
name="name"
type="java.lang.String"
update="true"
insert="true"
column="name"
/>
<set
name="modelCoverage"
lazy="false"
cascade="save-update"
sort="unsorted"
>
<key
column="referencer_id"
>
</key>
<one-to-many
class="com.seqis.kltm.model.db.project.ModelCoverage"
/>
</set>
</joined-subclass>
Code:
<class
name="com.seqis.kltm.model.db.project.ModelCoverage"
table="model_coverage"
>
<id
name="objectId"
column="object_id"
type="long"
>
<generator class="native">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-ModelCoverage.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>
<property
name="comment"
type="java.lang.String"
update="true"
insert="true"
column="comment"
length="8192"
/>
<many-to-one
name="referenced"
class="com.seqis.kltm.model.db.abstracts.ProjectPersModelWithCreation"
cascade="all"
outer-join="auto"
update="true"
insert="true"
column="referenced_id"
not-null="true"
/>
<many-to-one
name="referencer"
class="com.seqis.kltm.model.db.abstracts.ProjectPersModelWithCreation"
cascade="all"
outer-join="auto"
update="true"
insert="true"
column="referencer_id"
not-null="true"
/>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-ModelCoverage.xml
containing the additional properties and place it in your merge dir.
-->
</class>
my problem is, that the hibernate generates two has two foreign keys for the field 'referencer' in the object 'ModelCoverage', one to 'ReqTest' and one to 'TRefTest', but the only foreign key should reference the superclass 'ProjectPersModel...', because the field cannot reference two different tables at the same time...
TIA