From Hibernate in Action:
"The easiest way to represent the association from User to its billingAddress (a one to one association) is to
use a <many-to-one> mapping with a unique constraint on the foreign key. This may
surprise you, since many doesn’t seem to be a good description of either end of a
one-to-one association! However, from Hibernate’s point of view, there isn’t much
difference between the two kinds of foreign key associations."
In fact this surprise me, what are the advantages of use many-to-one instead one-to-one, many-to-one need one more attribute (unique="true") and one-to-one tend to be more intuitive for future reviews (many-to-one may confuse another developers, just like me)
Thanks.
|