Reading some hibernate documentation, I've stumbled upon this pattern :
<class name="Person">
<id name="id" column="personId">
<generator class="native"/>
</id>
<many-to-one name="address"
column="addressId"
unique="true"
not-null="true"/>
</class>
<class name="Address">
<id name="id" column="addressId">
<generator class="native"/>
</id>
<one-to-one name="person"
property-ref="address"/>
</class>
At first glance this seems pretty straightforward. Each Person have one and only one address, and each Address have a person.
But in a DB this pattern would allow an Address to have multiple Person referencing it, how hibernate could resolve this mapping without a list ? How a one-to-one can have a property-ref on a many-to-one field ? I think it should only be possible to have many-to-one <=> one-to-many or one-to-one <=> one-to-one.
edit : Althought it seems possible (if not semantically correct) to make a one-to-one <=> one-to-many mapping, my question is about many-to-one <=> one-to-one.
I know that there are already some answers about one-to-one vs many-to-one on this site, but I didn't found an answer to my question in these posts.
Thank you for your time.