| This is a kind of a follow up because
HHH-10690 Open 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
@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. |