HHH-17686 Avoid internal use of pruned expression for named references
This commit is contained in:
parent
702caf471c
commit
24d25cedf8
|
@ -5710,7 +5710,7 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void registerAffectedTable(NamedTableReference tableReference) {
|
protected void registerAffectedTable(NamedTableReference tableReference) {
|
||||||
registerAffectedTable( tableReference.getTableExpression() );
|
tableReference.applyAffectedTableNames( this::registerAffectedTable );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void registerAffectedTable(String tableExpression) {
|
protected void registerAffectedTable(String tableExpression) {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import java.util.Locale;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import org.hibernate.Internal;
|
||||||
import org.hibernate.spi.NavigablePath;
|
import org.hibernate.spi.NavigablePath;
|
||||||
import org.hibernate.sql.ast.SqlAstWalker;
|
import org.hibernate.sql.ast.SqlAstWalker;
|
||||||
|
|
||||||
|
@ -60,31 +61,26 @@ public class NamedTableReference extends AbstractTableReference {
|
||||||
sqlTreeWalker.visitNamedTableReference( this );
|
sqlTreeWalker.visitNamedTableReference( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void applyAffectedTableNames(Consumer<String> nameCollector) {
|
|
||||||
nameCollector.accept( getTableExpression() );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getAffectedTableNames() {
|
public List<String> getAffectedTableNames() {
|
||||||
return Collections.singletonList( getTableExpression() );
|
return Collections.singletonList( tableExpression );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsAffectedTableName(String requestedName) {
|
public boolean containsAffectedTableName(String requestedName) {
|
||||||
return isEmpty( requestedName ) || getTableExpression().contains( requestedName );
|
return isEmpty( requestedName ) || tableExpression.equals( requestedName );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean visitAffectedTableNames(Function<String, Boolean> nameCollector) {
|
public Boolean visitAffectedTableNames(Function<String, Boolean> nameCollector) {
|
||||||
return nameCollector.apply( getTableExpression() );
|
return nameCollector.apply( tableExpression );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableReference resolveTableReference(
|
public TableReference resolveTableReference(
|
||||||
NavigablePath navigablePath,
|
NavigablePath navigablePath,
|
||||||
String tableExpression) {
|
String tableExpression) {
|
||||||
if ( tableExpression.equals( getTableExpression() ) ) {
|
if ( this.tableExpression.equals( tableExpression ) ) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,9 +67,6 @@ public class UnionTableReference extends NamedTableReference {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasTableExpression(String tableExpression) {
|
private boolean hasTableExpression(String tableExpression) {
|
||||||
if ( tableExpression.equals( getTableExpression() ) ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
for ( String expression : subclassTableSpaceExpressions ) {
|
for ( String expression : subclassTableSpaceExpressions ) {
|
||||||
if ( tableExpression.equals( expression ) ) {
|
if ( tableExpression.equals( expression ) ) {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue