The fix for HHH-12436 involves correcting the foreign key direction for "real" one-to-one associations. I've been looking into the ramifications of this change because I'm concerned that applications can rely on the old (incorrect) foreign key direction.
In the process I've found that Hibernate treats: @OneToOne @PrimaryKeyJoinColumn private Employee employee; differently from: @OneToOne @MapsId private Employee employee; I believe they should be treated consistently. You can see my reasoning below. [1] Before going into details about how they are treated differently, I'd like to get confirmation, in case I am missing some subtlety. Could someone please confirm this? Regards, Gail --------------------------------------------------------------------------------------------- [1] In 2.4.1.3 Examples of Derived Identities, Example 4(b) uses MapsId without the value element as follows: @MapsId @JoinColumn(name="FK") @OneToOne Person patient; This example has the following footnote: "[15] Note that the use of PrimaryKeyJoinColumn instead of MapsId would result in the same mapping in this example. Use of MapsId is preferred for the mapping of derived identities." The description has a footnote that says that using PrimaryKeyJoinColumn instead of MapsId would result in the same mapping. In 11.1.45 PrimaryKeyJoinColumns Annotation, Example 2 uses @PrimaryKeyJoinColumns as follows: @OneToOne @PrimaryKeyJoinColumns({ @PrimaryKeyJoinColumn(name="ID", referencedColumnName="EMP_ID"), @PrimaryKeyJoinColumn(name="NAME", referencedColumnName="EMP_NAME")}) EmployeeInfo info; This example has the following footnote: "[123]Note that the derived identity mechanisms decribed in section 2.4.1.1 is now preferred to the use of PrimaryKeyJoinColumn for this case." _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev