Default join column name linked with physical name, not logical

Description

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.

Environment

version 5.2.7, database Postgres 4.6

Assignee

Unassigned

Reporter

Štěpán Plachý

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

4.1.6

Components

Affects versions

Priority

Major
Configure