I am attempting to use middlegen to generate hbms for two classes in a one-to-one relation with composite keys. However, rather than using a shared class (call it PKClass) for the composite key in each class, middlegen generates seperate classes for each composite id (Class1PK and Class2PK). Here is essentially (irrelevant parts removed) what I get:
<class name="Class1">
<composite-id name="comp_id" class="Class1PK">
<key-property name="field1" column="column1">
<key-property name="field2" column="column2">
</composite-id>
<one-to-one
name="class2"
class="Class2"
outer-join="auto">
</class>
<class name="Class2">
<composite-id name="comp_id" class="Class2PK">
<key-property name="field1" column="column1">
<key-property name="field2" column="column2">
</composite-id>
<one-to-one
name="class1"
class="Class1"
outer-join="auto">
</class>
In order for this mapping to work properly, I just manually make the composite-id classes the same (i.e. both Class1PK), but I wondering if I am missing an option in middlegen that will do this for me.
|