Do not expose id class embeddables through getManagedTypes

This commit is contained in:
Christian Beikov 2022-03-10 13:33:34 +01:00
parent 7f4a4afd64
commit 955e8265dc
2 changed files with 10 additions and 3 deletions

View File

@ -375,10 +375,13 @@ public class MetadataContext {
}
( ( AttributeContainer<?>) embeddable ).getInFlightAccess().finishUp();
embeddables.put( embeddable.getJavaType(), embeddable );
// Do not process embeddables for entity types i.e. id-classes
if ( !( embeddable.getExpressibleJavaType() instanceof EntityJavaType<?> ) ) {
embeddables.put( embeddable.getJavaType(), embeddable );
if ( staticMetamodelScanEnabled ) {
populateStaticMetamodel( embeddable );
if ( staticMetamodelScanEnabled ) {
populateStaticMetamodel( embeddable );
}
}
}
}

View File

@ -509,6 +509,10 @@ public class JpaMetamodelImpl implements JpaMetamodelImplementor, Serializable {
}
for ( EmbeddableDomainType<?> embeddable : context.getEmbeddableTypeSet() ) {
// Do not register the embeddable types for id classes
if ( embeddable.getExpressibleJavaType() instanceof EntityJavaType<?> ) {
continue;
}
switch ( jpaMetaModelPopulationSetting ) {
case IGNORE_UNSUPPORTED:
if ( embeddable.getJavaType() != null && embeddable.getJavaType() != Map.class ) {