views:

62

answers:

0

I have a root object, Policy, that has a compositeKey of PolicyNumber/PolicyDate.

The Policy has a one-to-many collection of PolicyDetails which have a composite key of PolicyNumber/PolicyDate/Sequence. Sequence is an assigned value that is set by the application.

My Mapping for Policy is below. I'm able to do a get and populate my collection like I would expect. However, my updates are failing because NH is passing the Policy objects PK, which is 2 values, but the collection object has a PK requiring 3. This results in an IndexOutOfRangeException. This is a legacy Oracle DB and none of these tables have single ID identity type keys. Adding them isn't an option, so I need to figure out a way to make this happen.

<bag cascade="save-update" fetch="select" lazy="false" name="PolicyDetails " mutable="true">
      <key>
        <column name="`POLICY_NUMBER`" />
        <column name="`POLICY_DATE_TIME`" />
      </key>
      <one-to-many class="NHibernate.Spike.Core.Entities.PolicyDetails Record, NHibernate.Spike.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
    </bag>