When using a custom PhysicalNamingStrategy the `columnNames` require the physical name for JoinColumn (ManyToOne), but the logical name for normal columns. (imo the logical name is expected?)
I have tried to create a runnable example here: https://github.com/hpoul/hibernate-joincolumns-test-case/blob/master/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java
`TestPhysicalNamingStrategy` is a simple PhysicalNamingStrategy which simply appends _PHYSICAL to all names:
when running with:
The error is:
but with the following code it works:
which is weird, because i'd expect both being _PHYSICAL or both being logical names.
I have traced the problem back to: Ejb3JoinColumn#buildDefaultColumnName(final PersistentClass referencedEntity, final String logicalReferencedColumn) - this method returns the physical name:
but it is called by Ejb3JoinColumn#linkValueUsingDefaultColumnNaming which stores the result as logical name:
which probably makes no real sense? anyway, this makes the InFlightMetadataCollectorImpl -> columnNameBindingByTableMap.get("Test2").logicalToPhysical map look like:
which makes no sense for the JoinColumn..