| Hi,i need an help to solve this kind of Entity Mapping.
 
 First Entity: CityProvider
 Composite Id: idProvider; idCity
 column: idCountry
 
 Second Entity: Country
 Composity Id: idCountry, language
 
 I need a one-to-many mapping between CityProvider and Country.
 
 I tried this hbm file for CityProvider:
 ...
 <composite-id
 name="cityProviderId"
 class="it.newmedia.bravofly.backoffice.common.data.hibernate.beans.CityProviderId"
 unsaved-value="any"
 >
 <key-property
 name="idProvider"
 type="java.lang.Integer"
 column="ID_PROVIDER"
 />
 
 <key-property
 name="idCity"
 type="java.lang.String"
 column="ID_CITY"
 />
 </composite-id>
 <set
 name="cityProviderLanguageCountries"
 table="Country"
 lazy="false"
 cascade="none"
 sort="unsorted"
 >
 <key
 >
 <column
 name="ID_PROVIDER"
 />
 <column
 name="ID_CITY"
 />
 <column
 name="ID_COUNTRY"
 />
 </key>
 <one-to-many class="Country"/>
 </set>
 ...
 
 but I obtain this error:
 "Foreign key ... must have same number of columns as the referenced primary key ..."
 
 Thank you in advance for any help.
 
 
 |