i have 2 tables..
table1 - primary key(a, b)
table2 - primary key(a, c)
i need a many-to-many relationship to create a table3 with attributes a,b,c
table3 - primary key(a,b,c)
but the attribute 'a' exists in the both tables and hibernate give me an error like this -> Repeated column in mapping for collection
in a many-to-many relationship doesn't exists an insert="false" and an update="false" and i can't stop hibernate to try to create the same attribute 2 times.
----------------------------------
table1Mapping.hbm.xml
<hibernate-mapping package="...">
<class name="Table1" table="table1">
<composite-id name="table1Id" class="Table1Id">
<key-property name="a"/>
<key-property name="b"/>
</composite-id>
<set name="t1Table3" table="table3" inverse="true">
<key >
<column name="a" />
<column name="b" />
</key>
<many-to-many class="Table2" >
<column name="a" />
<column name="c" />
</many-to-many>
</set>
</hibernate-mapping>
table2Mapping.hbm.xml
<hibernate-mapping package="...">
<class name="Table2" table="table2">
<composite-id name="table2Id" class="Table2Id">
<key-property name="a"/>
<key-property name="c"/>
</composite-id>
<set name="t2Table3" table="table3">
<key >
<column name="a" />
<column name="c" />
</key>
<many-to-many class="Table2" >
<column name="a" />
<column name="b" />
</many-to-many>
</set>
</hibernate-mapping>
i put here an example of my mapping files.. maybe i have made a mistake somewhere..
so if this is possible, how i can solve this problem?
tanks for any help
|