In file Ejb3JoinColumn.java, method buildDefaultColumnName asks ImplicitNamingStrategy for join column name (logical name i assume), but the method at the end on line 742 returns physical name:
This result is then set as logical name in method linkValueUsingDefaultColumnNaming on line 471:
This can cause duplicate mapping. In my project i have database names in underscore_notation, java names in camelCaseNotation and join column is by default id of referenced entity.
I have physical naming strategy that converts camel case to underscore and implicit naming strategy, where determineJoinColumnName returns source.getReferencedColumnName(). Note that name in underscore is not changed by the conversion.
When an entity is scanned, it maps physical name of the id in underscore to logical name in camel case, but when oneToMany relationship is scanned, method buildDefaultColumnName returns name in underscore and that name is treated as logical. It then tries to map physical name in underscore to logical name in underscore and that throws DuplicateMappingException, because physical name is now referred by both camel case and underscore names.
version 5.2.7, database Postgres 4.6