I changed table names and field name from file to match the TableA, TableB example I gave above. I didn't run them, so hopefully I got it right. Should give the idea at least. Changes between the Middlegen file and the one that ran are in red.
The mapping file generated by Middlegen:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping>
<!--
Created by Middlegen Hibernate plugin
http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->
<class
name="com.mjwall.TableD"
table="TABLE_D"
>
<meta attribute="field-description">
@hibernate.class
table="TABLE_D"
</meta>
<composite-id name="comp_id" class="com.mjwall.TableDPK">
<meta attribute="field-description">
@hibernate.id
generator-class="assigned"
</meta>
<!-- bi-directional many-to-one association to TableB -->
<key-many-to-one
name="tableB"
class="com.mjwall.TableB"
>
<column name="ID_B" />
<column name="ID_A" />
</key-many-to-one>
<!-- bi-directional many-to-one association to TableC -->
<key-many-to-one
name="tableC"
class="com.mjwall.TableC"
>
<column name="ID_C" />
<column name="ID_A" />
</key-many-to-one>
</composite-id>
<!-- associations -->
</class>
</hibernate-mapping>
And the mapping file after my edits.
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping>
<!--
Created by Middlegen Hibernate plugin
http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->
<class
name="com.mjwall.TableD"
table="TABLE_D"
>
<meta attribute="field-description">
@hibernate.class
table="TABLE_D"
</meta>
<composite-id name="comp_id" class="com.mjwall.TableDPK">
<meta attribute="field-description">
@hibernate.id
generator-class="assigned"
</meta>
<key-property
name="IdA"
column="ID_A"
type="java.math.BigDecimal"
length="22"
/>
<key-property
name="IdB"
column="ID_B"
type="java.math.BigDecimal"
length="22"
/>
<key-property
name="IdC"
column="ID_C"
type="java.math.BigDecimal"
length="22"
/>
</composite-id>
<many-to-one
name="tableC"
class="com.mjwall.TableC"
update="false"
insert="false">
<column name="ID_A" />
<column name="ID_C" />
</many-to-one>
<many-to-one
name="tableB"
class="com.mjwall.TableB"
update="false"
insert="false">
<column name="ID_A" />
<column name="ID_B" />
</many-to-one>
</class>
</hibernate-mapping>
I need to add this the Middlegen Jira too I suppose.