damomurf wrote:
hhuber wrote:
Read
8.4.1. one to many / many to one. I think this should be exactly what you need.
Actually, no - the one-to-many and many-to-one mappings here use exactly primary key fields and not foreign key fields.
I'm intrigued too. How can I map a relationship, say it's many to one using foreign keys in table A to fields in table B that aren't part of B's primary key either - and I'm talking about multiple fields?
The reference documentation doesn't really give any examples of this, and given that the reference docs are driven by example, it makes it rather difficult.
You can specify a property-ref on the many-to-one.
See
6.1.10 many-to-one.
On the master side, you have to group the properties using
properties. This way you can refer to multiple properties by one name.
I've got no clue though, how you'd do this on the one-to-many side, since you don't use the primary key of the master to join.
The only thing I know is that you have to use column elements below your key element (or a property-ref again):
Code:
<key >
<column name="detailCol1" />
<column name="detailCol2" />
</key>