Hibernate version: 3.0.1
App server: JBoss
Name and version of the database you are using: Oracle 8i
Code:
<map name="product_parts" table="PRODUCT_PART">
<key column="PRODUCT_CODE" not-null="true"/>
<map-key type="java.lang.String" column="PART_ID" />
<many-to-many class="eg.Part" column="PART_CODE"/>
</map>
where:
PRODUCT (
PRODUCT_CODE, DESCRIPTION)
PART (
PART_CODE, DESCRIPTION)
PRODUCT_PART (
PRODUCT_CODE , PART_ID)
Above mapping is in the Product.hbm.xml
I was able to do this with using a Set. But now need to try it with a Map.
This mappin gives an invalid column exception when a query is executed. But there arn't any mapping error at the JBoss start up.
Pls let me know the correct way of mapping this senario also the actual column that needs to be specified as the <map-key> and as the <many-to-many>.
thanks
Shanika