crash wrote:
Situation:
A <-- link table AB --> B
A has IdentityA column as PK;
B has IdentityB column as PK;
AB contains FKs to both tables (IdentityA and IdentityB FKs).
In real case A is linked to B as 1:1, meaning that there is only one B related to A.
Is there a way to write such mapping file, so that A contained not the list of Bs, but just one reference to B (as using <many-to-one> mapping)?
Yes you will need to use a join. It eventually should look something like:
Code:
<class name="A" ...>
....
<join table="AB">
<key name="IndentityA" unique="true"/>
<many-to-one name="bPropertyInA" column="IndentityB" class="B" unique="true"/>
</join>
...
</class>
Farzad-