mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-10 05:04:52 +00:00
HHH-16792 Unqualify table expressions for cte table names
This commit is contained in:
parent
f20805b1f7
commit
96f7f48e55
@ -11,6 +11,7 @@
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.boot.model.naming.Identifier;
|
||||
import org.hibernate.boot.model.relational.QualifiedNameParser;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||
@ -183,7 +184,7 @@ protected void addDmlCtes(
|
||||
protected String getCteTableName(String tableExpression) {
|
||||
final Dialect dialect = getSessionFactory().getJdbcServices().getDialect();
|
||||
if ( Identifier.isQuoted( tableExpression ) ) {
|
||||
tableExpression = tableExpression.substring( 1, tableExpression.length() - 1 );
|
||||
tableExpression = QualifiedNameParser.INSTANCE.parse( tableExpression ).getObjectName().getText();
|
||||
}
|
||||
return Identifier.toIdentifier( DELETE_RESULT_TABLE_NAME_PREFIX + tableExpression ).render( dialect );
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
import org.hibernate.boot.model.naming.Identifier;
|
||||
import org.hibernate.boot.model.relational.QualifiedNameParser;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||
@ -324,7 +325,7 @@ private TableReference resolveTableReference(
|
||||
protected String getCteTableName(String tableExpression) {
|
||||
final Dialect dialect = getSessionFactory().getJdbcServices().getDialect();
|
||||
if ( Identifier.isQuoted( tableExpression ) ) {
|
||||
tableExpression = tableExpression.substring( 1, tableExpression.length() - 1 );
|
||||
tableExpression = QualifiedNameParser.INSTANCE.parse( tableExpression ).getObjectName().getText();
|
||||
}
|
||||
return Identifier.toIdentifier( UPDATE_RESULT_TABLE_NAME_PREFIX + tableExpression ).render( dialect );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user