Problem with one-to-one mapping using discriminator
posted 8 years ago
I am trying to map distinct variations of a table entry by using a discriminator-value.
I have a table called Agreement. The entries in this table could be of many AgreementTypes. Some, but not all agreements have an AgreementDetail. The table AgreementDetail is mapped in its own mapping file.
I want only those I discriminate to get an AgreementDetail. This I will define in the subclass.
There is a one-to-one relationship between Agreement and AgreementDetail, but trying to define a <one-to-one></one-to-one> does not work. The primary keys of AgreementDetail has the same primary keys as Agreement, plus one more. Its those two primary keys of Agreement I must use to find an AgreementDetail.
By trying the following I get the error message "broken coulmn mapping for agreementDetail.id of: AgreementDetail" <one-to-one name="agreementDetail" class="AgreementDetail"></one-to-one>
Here are a piece of my mapping. This mapping work as it is, but has no AgreementDetail mapping for the subclass.
[ April 21, 2008: Message edited by: Sverre Moe ] [ April 21, 2008: Message edited by: Sverre Moe ]