The Link has two Ports, one is source port and another is destination port. and one port only can be used by one Link.
so, I want to set two one-to-one mapping attributes in LINK.hbm.xml, but I don't kown how to set the one-to-one mapping attributes in Port.hbm.xml.
The following is Link.hbm.xml
<hibernate-mapping>
<class
name="TransportLink"
table="TRANSPORTLINK" >
<many-to-one
name="APort"
class="Port"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="APORTID"
not-null="true"
unique="true"
/>
<many-to-one
name="ZPort"
class="Port"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="ZPORTID"
not-null="true"
unique="true"
/>
</class>
</hibernate-mapping>
and how to write the port.hbm.xml to realize bidirectional one-to-one mapping?
Thanks very much!
|