Hibernate does not correctly resolve embeddable in the metamodel

Description

Hello,

I have the following entity:

So basically a product with a name where the name is a Map of Locale - LocalizedValueInterface and this interface is the interface for the LocalizedValue embeddable class:

Now when Hibernate creates the JPA Metamodel I see what ends in there is a collection of all entities (which correctly contains my Product entity) and a collection of all embeddables (which incorrectly contains only the LocalizedValueInterface). I followed the code and found out this:

in AttributeFactory#PluralAttributeMetadataImpl on line 781. This code inspects the map and takes the second class in the generics argument and uses it for embeddable class. I think it should take it from the @ElementCollection(targetClass = LocalizedValue.class) annotation, or it should scan the classpath for @Embeddable annotation and all those that have it.

Environment

None

Status

Assignee

Unassigned

Reporter

Petar Tahchiev

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Blocker
Configure