Forums Register Login

Problem with one-to-one mapping using discriminator

+Pie Number of slices to send: Send
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 ]
+Pie Number of slices to send: Send
discriminators are used for Inheritance mapping, not relational mapping.

To map one-to-one follow the documentation here

http://www.hibernate.org/hib_docs/v3/reference/en/html/associations.html#assoc-bidirectional-121

I am thinking your mapping might just be a straight simple One-to-one mapping like in the documentation.

Mark
Their achilles heel is the noogie! Give them noogies tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1148 times.
Similar Threads
Simple mapping issue for Hibernate newbie
mapping question (hashmap and subclasses)
Problem with joining of two tables with Hibernate
Hibernate mapping using Oracle XML
Using discriminator on base class with no subclasses
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 07:42:18.