hibernate document说A unidirectional many-to-one association on a join table is common when the association is optional.
。为什么在冬眠期间单向多对一关联是可选的
请让我知道为什么它叫optional
在这里?
<class name="Person">
<id name="id" column="personId">
<generator class="native"/>
</id>
<join table="PersonAddress"
optional="true">
<key column="personId" unique="true"/>
<many-to-one name="address"
column="addressId"
not-null="true"/>
</join>
</class>
解释这可能是有益的:HTTPS://forum.hibernate。 org/viewtopic.php?f = 1&t = 981119 –