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

Activity

Show:
Gail Badner
October 21, 2016, 7:40 AM

Please attach a minimal test case (ie., that does not use Sprint) that reproduces your issue. You can find test templates at https://github.com/hibernate/hibernate-test-case-templates.

Petar Tahchiev
November 25, 2016, 8:01 PM

Hello,

please find a test-case with the hibernate template here: https://github.com/ptahchiev/HHH-11111-hibernate-template

Petar Tahchiev
December 20, 2016, 2:53 PM

Any updates here? Is there anything I can do to help with this issue?

Christian Beikov
December 21, 2016, 9:49 AM

Since it seems you know what the actual problem is you could try to provide a pull request containing a testcase and a fix or at least sketch a possible fix in a comment.

Vlad Mihalcea
May 3, 2017, 3:30 PM

According to this commit, a test case was added and dthe issue cannot replicate.

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