Q:

Many-to-One w/ Composite key- Foreign key must have same number of columns as he referenced PK

Problem Summary
I am trying to map a many-to-one with a composite key. So far I haven't been able to locate another question that helps. I know how to map to a composite key with one-to-one, but it is not allowing me to map many-to-one. 
Below you will see bhrvJournalDAO has a store_nbr column, that maps to transAcctgBuTxtDAO acctg_bu_id. How can I hit the composite key and tell it to only use the acctgBuId? I do not have a country code (which is the second part of the composite key).
From Here
<hibernate-mapping>
<class name="com.acctg.BhrvJournalDAO" table="transpo_acctg:bhrv_journal">
    <id name="jeId" column="je_id">
        <generator class="native"/>
    </id>
    <property name="bhrvInvoiceId" column="bhrv_invoice_id"/>
    <property name="storeNbr" column="store_nbr"/>
    <property name="loadId" column="load_id"/>

  <many-to-one name="transAcctgBuTxt" class="TransAcctgBuTxtDAO" insert="false" update="false" cascade="all">
              <column name="store_nbr"></column>
  </many-to-one>
</class>

To Here
<hibernate-mapping>
<class name="TransAcctgBuTxtDAO"    table="transpo_acctg:trans_acctg_bu_txt">
    <composite-id name="transAcctgBuTxtPKDAO"   class="TransAcctgBuTxtPKDAO">
        <key-property name="acctgBuId" column="acctg_bu_id"/>
        <key-property name="languageCode" column="language_code"/>
    </composite-id>
    <property name="acctgBuAbbr" type="java.lang.String">
        <column name="acctg_bu_abbr" />
    </property>
    <property name="acctgBuDesc" type="java.lang.String">
        <column name="acctg_bu_desc" />
    </property>
    <many-to-one name="transAcctgBuDAO"  class="TransAcctgBuDAO" not-null="false" 
        insert="false" update="false" not-found="ignore" fetch="select">
        <column name="acctg_bu_id" />
    </many-to-one>
 </class>

Mapping
  <many-to-one name="transAcctgBuTxt" class="TransAcctgBuTxtDAO" 
        insert="false" update="false" cascade="all">
              <column name="store_nbr"></column>
  </many-to-one>

Composite Key Example
 <one-to-one name="transAcctgBuTxt" class="TransAcctgBuTxtDAO" property-
       ref="transAcctgBuTxtPKDAO.acctgBuId"> 
        <column name = "store_nbr">
 </one-to-one>

Error
Foreign key (FK47A121BB6617227C:transpo_acct:bhrv_journal [store_nbr])) 
must have same number of columns as the referenced primary 
key (transpo_acct:trans_acctg_bu_txt [acctg_bu_id,language_code])

Thanks in advance

A:

Since TransAcctgBuTxtDAO has the composite id of 2 columns, you NEED to provide both values to uniquely identify one entity, period. Maybe you could reconsider if it is really a many-to-one relation between BhrvJournalDAO and TransAcctgBuTxtDAO. Mabye it is actually many-to-many.

