HHH-18894 Create and return new EnumJavaType object if class name represents enum that is not currently known
This commit is contained in:
parent
78e6d632f2
commit
816b29d390
|
@ -319,7 +319,21 @@ public class JpaMetamodelImpl implements JpaMetamodelImplementor, Serializable {
|
|||
|
||||
@Override
|
||||
public EnumJavaType<?> getEnumType(String className) {
|
||||
return enumJavaTypes.get( className );
|
||||
final EnumJavaType<?> enumJavaType = enumJavaTypes.get( className );
|
||||
if ( enumJavaType != null ) {
|
||||
return enumJavaType;
|
||||
}
|
||||
final ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
|
||||
try {
|
||||
final Class<Object> clazz = classLoaderService.classForName( className );
|
||||
if ( clazz == null || !clazz.isEnum() ) {
|
||||
return null;
|
||||
}
|
||||
return new EnumJavaType( clazz );
|
||||
}
|
||||
catch (ClassLoadingException e) {
|
||||
throw new RuntimeException( e );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue