HHH-12486 - Avoid unnecessary exceptions during entity persister lookup during query compilation

This commit is contained in:
Christian Beikov 2018-04-13 15:55:24 +02:00 committed by Steve Ebersole
parent 5803ad5839
commit 2de4277c34
1 changed files with 3 additions and 5 deletions

View File

@ -138,11 +138,9 @@ public class SessionFactoryHelper {
*/ */
public EntityPersister findEntityPersisterByName(String name) throws MappingException { public EntityPersister findEntityPersisterByName(String name) throws MappingException {
// First, try to get the persister using the given name directly. // First, try to get the persister using the given name directly.
try { EntityPersister persister = sfi.getMetamodel().entityPersisters().get( name );
return sfi.getMetamodel().entityPersister( name ); if ( persister != null ) {
} return persister;
catch ( MappingException ignore ) {
// unable to locate it using this name
} }
// If that didn't work, try using the 'import' name. // If that didn't work, try using the 'import' name.