diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/BasicFormatterImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/BasicFormatterImpl.java index 99949e6a8a..f7cf8777ad 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/BasicFormatterImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/BasicFormatterImpl.java @@ -279,6 +279,7 @@ public class BasicFormatterImpl implements Formatter { private void endCase() { afterBeginBeforeEnd = false; decrementIndent(); + decrementIndent(); logical(); } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java index 6f5c38d615..60bbeeb740 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java @@ -1336,17 +1336,7 @@ public abstract class AbstractEntityPersister @Override public boolean containsTableReference(String tableExpression) { - if ( getTableName().equals( tableExpression ) ) { - return true; - } - else { - for ( int i = 0; i < getSubclassTableSpan(); i++ ) { - if ( getSubclassTableName( i ).equals( tableExpression ) ) { - return true; - } - } - return false; - } + return contains( getSubclassTableNames(), tableExpression ); } @Override @@ -3076,7 +3066,7 @@ public abstract class AbstractEntityPersister rootTableReference, true, sqlAliasBase, - (tableExpression) -> contains( getSubclassTableNames(), tableExpression ), + (tableExpression) -> getRootEntityDescriptor().containsTableReference( tableExpression ), (tableExpression, tg) -> { final String[] subclassTableNames = getSubclassTableNames(); for ( int i = 0; i < subclassTableNames.length; i++ ) {