| Ah so you're experiencing issues for one to one associations without a back reference, I think that will help creating a test case. The check you point to was broken, because the foreign key direction is not always TO_PARENT if the value is a reference to a primary key. In fact, the two entities may be each others primary key. So what matters is which one is responsible for generating the id (and has to be persisted first), and which one is dependent on that identifier (for example a OneToOne mapped using @MapsId. Obviously, when one side is mapped using the mappedBy property and the other side is not, the mapping with the mappedBy property set has to be the child side of the association. By the way the change you point to wasn't present prior to 5.2.13 in the first place. So I am not sure whether you have been running 5.2.13 or newer "forever" or that the issue is partially caused by any other change included in 5.4.0. Which version have you been running recently? I think we could very well have overlooked the possibility of a single sided one-to-one association that owns a relationship mapped by a PrimaryKeyJoinColumn. Which of the two entities is supposed to generate the id of the association? |