diff --git a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/FromElement.java b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/FromElement.java index bb47d0e090..1b0affe726 100644 --- a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/FromElement.java +++ b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/FromElement.java @@ -341,12 +341,10 @@ public class FromElement extends HqlSqlWalkerNode implements DisplayableNode, Pa final String propertyName = getIdentifierPropertyName(); - if ( getWalker().getStatementType() == HqlSqlTokenTypes.SELECT ) { - return getPropertyMapping( propertyName ).toColumns( table, propertyName ); - } - else { - return getPropertyMapping( propertyName ).toColumns( propertyName ); - } + return toColumns( + table, propertyName, + getWalker().getStatementType() == HqlSqlTokenTypes.SELECT + ); } public void setCollectionJoin(boolean collectionJoin) { diff --git a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/IdentNode.java b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/IdentNode.java index 81a26186c3..1574c57feb 100644 --- a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/IdentNode.java +++ b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/IdentNode.java @@ -197,14 +197,6 @@ public class IdentNode extends FromReferenceNode implements SelectExpression { String[] columnExpressions = element.getIdentityColumns(); - // determine whether to apply qualification (table alias) to the column(s)... - if ( ! isFromElementUpdateOrDeleteRoot( element ) ) { - if ( StringHelper.isNotEmpty( element.getTableAlias() ) ) { - // apparently we also need to check that they are not already qualified. Ugh! - columnExpressions = StringHelper.qualifyIfNot( element.getTableAlias(), columnExpressions ); - } - } - final Dialect dialect = getWalker().getSessionFactoryHelper().getFactory().getDialect(); final boolean isInCount = getWalker().isInCount(); final boolean isInDistinctCount = isInCount && getWalker().isInCountDistinct(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/hql/DeleteQuerySubqueryReferencingTargetPropertyTest.java b/hibernate-core/src/test/java/org/hibernate/test/hql/DeleteQuerySubqueryReferencingTargetPropertyTest.java index 3d91f66620..9e2be86721 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/hql/DeleteQuerySubqueryReferencingTargetPropertyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/hql/DeleteQuerySubqueryReferencingTargetPropertyTest.java @@ -10,7 +10,6 @@ import javax.persistence.criteria.CriteriaQuery; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; -import org.hibernate.testing.FailureExpected; import org.hibernate.testing.TestForIssue; import org.junit.Assert; import org.junit.Test; @@ -26,7 +25,6 @@ public class DeleteQuerySubqueryReferencingTargetPropertyTest extends BaseEntity } @Test - @FailureExpected(jiraKey = "HHH-12492") public void testSubQueryReferencingTargetProperty() { // prepare doInJPA( this::entityManagerFactory, entityManager -> {