Skip to content

Commit 6cddbc7

Browse files
committed
HHH-18819 Fix metamodel of id-class extending from mapped-superclasses
1 parent 893fdd1 commit 6cddbc7

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetadataContext.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -574,12 +574,28 @@ private Property getMappedSuperclassIdentifier(PersistentClass persistentClass)
574574
return null;
575575
}
576576

577-
private EmbeddableTypeImpl<?> applyIdClassMetadata(Component idClassComponent) {
578-
final JavaType<?> javaType =
577+
private <Y> EmbeddableTypeImpl<Y> applyIdClassMetadata(Component idClassComponent) {
578+
final JavaType<Y> javaType =
579579
getTypeConfiguration().getJavaTypeRegistry()
580580
.resolveManagedTypeDescriptor( idClassComponent.getComponentClass() );
581-
final EmbeddableTypeImpl<?> embeddableType =
582-
new EmbeddableTypeImpl<>( javaType, null, null, false, getJpaMetamodel() );
581+
582+
final MappedSuperclass mappedSuperclass = idClassComponent.getMappedSuperclass();
583+
final MappedSuperclassDomainType<? super Y> superType;
584+
if ( mappedSuperclass != null ) {
585+
//noinspection unchecked
586+
superType = (MappedSuperclassDomainType<? super Y>) locateMappedSuperclassType( mappedSuperclass );
587+
}
588+
else {
589+
superType = null;
590+
}
591+
592+
final EmbeddableTypeImpl<Y> embeddableType = new EmbeddableTypeImpl<>(
593+
javaType,
594+
superType,
595+
null,
596+
false,
597+
getJpaMetamodel()
598+
);
583599
registerEmbeddableType( embeddableType, idClassComponent );
584600
return embeddableType;
585601
}

0 commit comments

Comments
 (0)