Regular |
|
Joined: Tue May 11, 2004 9:23 am Posts: 69
|
I got 3 foreign keys in my table CustomerOrderLines and 2 in CustomerOrder. Right now I'm getting this fault:
Foreign key (CUSTOMERORDERLINE_T [CUSTOMERORDERNO])) must have same number of columns as the referenced primary key (CUSTOMERORDER_T [CUSTOMERORDERNO,COUNTRYCODE])
Do I need any specific tags in the xml-files to manage this situation where different amout of keys are used?
CustomerOrder
------------------
<class name="net.sf.hibernate.CustomerOrder" table="CUSTOMERORDER_T">
<composite-id name="compOrderLineID" class="net.sf.hibernate.CompositeCustOrdLinesID">
<key-property name="customerOrderNo" column="CUSTOMERORDERNO" type="string"/>
<key-property name="countryCode" column="COUNTRYCODE" type="string"/>
</composite-id>
<property name="deliveryDate" column="DELIVERYDATE"/>
<property name="price" column="PRICE"/>
<property name="freightCost" column="FREIGHTCOST"/>
<property name="status" column="STATUS"/>
<property name="paymentMode" column="PAYMENTMODE"/>
<property name="totalVolume" column="TOTALVOLUME"/>
<property name="totalWeight" column="TOTALWEIGHT"/>
<property name="totalCost" column="TOTALCOST"/>
<property name="versionNo" column="VERSIONNO"/>
</class>
CustomerOrderLines
------------------------
<class name="net.sf.hibernate.CustomerOrderLine" table="CUSTOMERORDERLINE_T">
<composite-id name="compOrderLineID" class="net.sf.hibernate.CompositeCustOrdLinesID">
<key-property name="orderLineNo" column="ORDERLINENO"/>
<key-many-to-one name="countryCode" column="COUNTRYCODE" class="net.sf.hibernate.CustomerOrder"/>
<key-many-to-one name="customerOrderNo" column="CUSTOMERORDERNO" class="net.sf.hibernate.CustomerOrder"/>
</composite-id>
<property name="articleNo" column="ARTICLENO"/>
<property name="articleName" column="ARTICLENAME"/>
<property name="quantity" column="QUANTITY"/>
<property name="price" column="PRICE"/>
<property name="volume" column="VOLUME"/>
<property name="weight" column="WEGHT"/>
<property name="deliveryDate" column="DELIVERYDATE"/>
</class>
Best regards
// Johan
|
|