<composite-id name="id" class="com.anylinks.billreturn.BO.ExchangeBank$Id" unsaved-value="undefined">
//这里
//把com.anylinks.billreturn.BO.ExchangeBank$Id的hbm.xml中的东西复制过来
      <key-property name="bankId" type="string">
        <column name="BankID" length="9" not-null="true" unique="true" index="PK_EXCHANGEBANK"/>
      </key-property>
      <key-property name="currName" type="string">
        <column name="CurrName" length="3" not-null="true"/>
      </key-property>
    </composite-id>

解决方案 »

  1.   

    没用过复合主键,不过错误好像是说ReturnOutMSG的外键要对应ExchangeBank
    的两个字段(复合主键),外键也要用两个?lz查查资料吧复合主键的问题很麻烦啊,不知lz为什么要用
      

  2.   

    hibernate最好不要用复合主键。
    你的ExchangeBank表的bankId外键引用ReturnOutMSG表的id是吧
        <many-to-one
            name="test"
        class="com.anylinks.billreturn.BO.ReturnOutMSG"
        update="false"
        insert="false"
    >
         <column name="bankId" />
    </many-to-one>
      

  3.   

    现在hibernate流行的主要原因是啥呢?看到的越来越多