I am creating this join from one table to another
with the followin query:
Code:
select sale.storeName
from sale sale, storelocation sc
where sale.store_id = sc.store_id
and sale.storeLocId = sc.storeLocId
and i put the mapping as below for the join
Code:
<many-to-one name="sale" class="com.dao.hibernate.sale" not-null="true">
<column name="store_id" />
<column name="storeLocId" />
</many-to-one>
in my store mapping i have the following:
Code:
<id name="store_id" type="java.lang.Integer" column="storeid">
<generator class="increment" />
</id>
<property name="storeLocId" type="java.lang.String"
column="storeLocId" not-null="true" length="10" />
and I am getting the error:
Code:
Error while initializing hibernate: Foreign key (FKD970FEE37F556750:SALE [store_id,storeLocId])) must have same number of columns as the referenced primary key (store_id"[store_id"])