Hi,
If i have table say, "TABLEA" which has a primary key on one column, lets say on "COLM1" and has another table "TABLEB", which has a composite key of two columns (COLM1 and COLM2).
If i want to have an association with these tables, what should i put in the mapping xml file?
CLASSA represents TABLEA
CLASSB represents TABLEB.
CLASSA has a reference to CLASSB.
COMPOSITECLASS for composite key of TABLEB.
is the following mapping file is correct or does it needs any changes. Can any body help me with this issue.
Code:
<class name="CLASSA" table="TABLEA">
<id name="keyID" column="COLM1">
<generator class="assigned" />
</id>
..... some other properties.
<property />
<property />
.........
<one-to-one name="classB" class="CLASSB"/>
</class>
<class name="CLASSB" table="TABLEB">
<composite-id name="compKey" class="COMPOSITECLASS">
<key-property name="colm2" column="COLM2" type="integer"/>
<key-many-to-one name="keyID" class="CLASSA" column="COLM1"/>
</composite-id>
..... some other properties.
<property />
<property />
</class>
with this configuration i am getting mapping exception...
org.hibernate.MappingException: broken column mapping for: classB.id of: CLASSA