The fix for HHH-12436 involves correcting the foreign key direction for
some one-to-one assocations. In the process of making changes I see that we
have a unit test that has a unidirectional one-to-one association mapped
with constrained="false". [1]
ModelBinder assumes that <one-to-one ... constrained = "true"> means that
the foreign key direction is FROM_PARENT; if constrained = "false", it
assumes that the foreign key direction is TO_PARENT. [2]
It seems odd to me that the foreign key direction for a unidirectional
association would be TO_PARENT.
Should the unit test have constrained = "true"?
If not, should ModelBinder check to see if the association is bidirectional
and determine which side owns the association? This would probably require
adding a SecondPass.
Please let me know your thoughts.
Regards,
Gail
[1]
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src...
[2]
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src...