ImprovedNamingStrategy unqualifies property names - blocks the use of several composite types in the same entity

Description

Seems like ImprovedNamingStrategy unqualifies property names when processing column names.
I'm using EJB binding, and the strategy gets a property value like "somecomposite.foo" and "somecomposite.bar".

Now, if I want to use a composite typed property several times in an Entity, the base property name is removed (like "somecomposite"). If I have an entity with 2 composite properties:

public FooComposite getComposite1();
public FooComposite getComposite2();

ImprovedNamingStrategy should map it as "composite1.foo", "composite1.bar". Instead, we get "foo" and "bar" alone, and when mapping Composite2 Hibernate throws a MappingException: "org.hibernate.MappingException: Same logical column name referenced several times"

If we change:

public String logicalColumnName(String columnName, String propertyName) {
return StringHelper.isNotEmpty( columnName ) ? columnName : StringHelper.unqualify( propertyName );
}

For this:

public String logicalColumnName(String columnName, String propertyName) {
return StringHelper.isNotEmpty( columnName ) ? columnName : addUnderscores( propertyName );
}

The problem would get solved, I think.

Environment

None

Assignee

Unassigned

Reporter

Leonardo Quijano

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure