HHH-18486 Prioritize custom name-resolvers before defaulting to dynamic

This commit is contained in:
Marco Belladelli 2024-08-22 10:39:31 +02:00
parent 1ae633b5c6
commit 70137e7f09
1 changed files with 3 additions and 3 deletions

View File

@ -30,15 +30,15 @@ public class CoordinatingEntityNameResolver implements EntityNameResolver {
return entityName;
}
final MappingMetamodelImplementor mappingMetamodel = sessionFactory.getRuntimeMetamodels().getMappingMetamodel();
for ( EntityNameResolver resolver : mappingMetamodel.getEntityNameResolvers() ) {
for ( EntityNameResolver resolver : sessionFactory.getSessionFactoryOptions().getEntityNameResolvers() ) {
entityName = resolver.resolveEntityName( entity );
if ( entityName != null ) {
return entityName;
}
}
for ( EntityNameResolver resolver : sessionFactory.getSessionFactoryOptions().getEntityNameResolvers() ) {
final MappingMetamodelImplementor mappingMetamodel = sessionFactory.getRuntimeMetamodels().getMappingMetamodel();
for ( EntityNameResolver resolver : mappingMetamodel.getEntityNameResolvers() ) {
entityName = resolver.resolveEntityName( entity );
if ( entityName != null ) {
return entityName;