We're updating the issue view to help you get more done. 

Metamodel does not include embeddable type used in type variables

Description

This is a kind of a follow up because actually is part of the reason for this problem. Embeddable types that only ever get used in a type variable are not picked up by the JPA metamodel implementation. Let's take a look at the following example

1 2 3 4 5 6 7 8 9 10 11 12 13 14 @MappedSuperclass public class BaseEntity<T extends Serializable> { @EmbeddedId private T id; } @Embeddable public class MyEntityId implements Serializable { private String someValue; } @Entity public class MyEntity extends BaseEntity<MyEntityId> { }

The type MyEntityId will not be available via metamodel.managedType(MyEntityId.class) because currently, Hibernate only adds types to the type registry that are either root types or the types of attributes. Since the attribute id in this case has the type bound as attribute type i.e. java.io.Serializable there is no managed type instance created for the real type MyEntityId.
Instead a managed type instance for java.io.Serializable is created which is obviously wrong. There should be no manage type instance for java.io.Serializable but only for MyEntityId.

Environment

None

Status

Assignee

Christian Beikov

Reporter

Christian Beikov

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

Components

Affects versions

5.2.8

Priority

Major