Hello all,
I have 2 tables with composite key's
PRODUCT_VERSIONS:
PRODUCT_ID NOT NULL NUMBER(38)
PRODUCT_VERSION NOT NULL VARCHAR2(10)
which has one to many mapping to
SHELVES_PRODUCT:
PRODUCT_ID NOT NULL NUMBER(38)
PRODUCT_VERSION NOT NULL VARCHAR2(10)
SHELF_ID NOT NULL NUMBER(38)
each product version has many shelves
but I get an error and I dont understand why:
Foreign key (FK60ADE117BF964528:LB_SHELVES_PROD [SHELF_ID])) must have same number of columns as the referenced primary key (LB_PRODUCTS_VER [PRODUCT_ID,PRODUCT_VERSION])
Hibernate version: 3.0
Mapping documents:
<class name="com.softlib.LB.classes.version" table="LB_PRODUCTS_VER">
<composite-id name="Vpk" class="com.softlib.LB.classes.versionPK"> <key-property name="product_id"> <column name="PRODUCT_ID" sql-type="number(38)" not-null="true"/> </key-property> <key-property name="name"> <column name="PRODUCT_VERSION" sql-type="varchar2(10)" not-null="true"/> </key-property> </composite-id>
<many-to-one name="productObject" insert="false" update="false" class="com.softlib.LB.classes.product" column="PRODUCT_ID" /> <set name="shelves_products" table="LB_SHELVES_PROD" inverse="true" cascade="all"> <key> <column name="PRODUCT_ID"/> <column name="PRODUCT_VERSION"/> </key>
<one-to-many class="com.softlib.LB.classes.shelves_products"/> </set>
</class>
<class name="com.softlib.LB.classes.shelves_products" table="LB_SHELVES_PROD">
<composite-id> <key-property name="product_id"> <column name="PRODUCT_ID" sql-type="number(38)" not-null="true"/> </key-property> <key-property name="name"> <column name="PRODUCT_VERSION" sql-type="varchar2(10)" not-null="true"/> </key-property> <key-many-to-one name="shelfObject" class="com.softlib.LB.classes.shelf"> <column name="SHELF_ID"/> </key-many-to-one> </composite-id>
</class>
Name and version of the database you are using: Oracle 8i
_________________ cheers and thanks in advance,
Yaniv David.
|