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

(cherry picked from commit 2de4277c34)
This commit is contained in:
Christian Beikov 2018-04-13 15:55:24 +02:00 committed by Steve Ebersole
parent 08748481ed
commit 436500dc13
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 {
// First, try to get the persister using the given name directly.
try {
return sfi.getMetamodel().entityPersister( name );
}
catch ( MappingException ignore ) {
// unable to locate it using this name
EntityPersister persister = sfi.getMetamodel().entityPersisters().get( name );
if ( persister != null ) {
return persister;
}
// If that didn't work, try using the 'import' name.