|
Comment:
|
Test case pushed: https://github.com/hibernate/hibernate-orm/commit/4d461cc44ebe0f017c6a79471e8e8f77c48450fc
[~stliu], I might need a bit of help after all.
In ProductDetails, if you change {code} @ManyToOne(fetch = FetchType.EAGER, cascade = {CascadeType.ALL}) @JoinColumns({ @JoinColumn(name = "id_product", referencedColumnName = "id_product", nullable = false), @JoinColumn(name = "id_product_version", referencedColumnName = "id_product_version", nullable = false) }) private Product product; {code} to {code} @ManyToOne(fetch = FetchType.EAGER, cascade = {CascadeType.ALL}) @JoinColumn(name = "id_product_version", referencedColumnName = "id_product_version", nullable = false) private Product product; {code} , the "id_product_version" logical name is bound for the *product* table first, then product_details (as it should be).
The FkSecondPass correctly has both Columns if the @JoinColumns is left in place. So, I believe that's bound correctly.
I'm having trouble understanding if the problem is in: - Configuration#processFkSecondPassInOrder (as you mentioned, sp.isInPrimaryKey is false for all these cases) - ToOneFkSecondPass#doSecondPass -> BinderHelper#createSyntheticPropertyReference -> Ejb3JoinColumn#checkReferencedColumnsType() - The order in which FkSecondPasses are created
|