Skip to content

Commit

Permalink
HHH-18894 Create new EnumJavaType if class name represents enum that …
Browse files Browse the repository at this point in the history
…is not currently known
  • Loading branch information
cigaly committed Nov 29, 2024
1 parent 2807cf6 commit 005b599
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,22 @@ public Set<EmbeddableType<?>> getEmbeddables() {

@Override
public EnumJavaType<?> getEnumType(String className) {
return enumJavaTypes.get( className );
if ( enumJavaTypes.containsKey( className ) ) {
return enumJavaTypes.get( className );
}
final ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
try {
final Class<Object> clazz = classLoaderService.classForName( className );
if ( clazz == null || !clazz.isEnum() ) {
return null;
}
final EnumJavaType enumType = new EnumJavaType( clazz );
enumJavaTypes.put( className, enumType );
return enumType;
}
catch (ClassLoadingException e) {
throw new RuntimeException( e );
}
}

@Override
Expand Down

0 comments on commit 005b599

Please sign in to comment.