diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/cte/CteDeleteHandler.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/cte/CteDeleteHandler.java index 4534368576..53936e8320 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/cte/CteDeleteHandler.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/cte/CteDeleteHandler.java @@ -11,6 +11,7 @@ import java.util.List; 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 @@ public class CteDeleteHandler extends AbstractCteMutationHandler implements Dele 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 ); } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/cte/CteUpdateHandler.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/cte/CteUpdateHandler.java index d1f2c45329..dbe4332987 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/cte/CteUpdateHandler.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/cte/CteUpdateHandler.java @@ -12,6 +12,7 @@ import java.util.Map; 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 @@ public class CteUpdateHandler extends AbstractCteMutationHandler implements Upda 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 ); }