【发布时间】:2014-11-03 14:31:12
【问题描述】:
hbm 文件中的两个标签如何与unique="true" 一对一和多对一不同?
我刚刚了解到,要获得双向的一对一映射,我需要在两个 hbm 文件上使用一对一的标签。我不能将多对一与unique="true" 放在两边(都是hbm)以获得休眠中的双向行为吗?
在这个link,我找到了
<!-- In One-to-one we cannot specify the foreign key column
that has to be filled up
<one-to-one name="person" class="PersonOTO_B" cascade="all"
constrained="true"> </one-to-one>
-->
<many-to-one name="person" column="P_ID" unique="true"
not-null="true" lazy="false" />
上述理由是否成立?
问候 贾延德拉
【问题讨论】:
标签: hibernate mapping hibernate-mapping one-to-one associative