[hibernate-commits] [hibernate/hibernate-orm] 48f59e: HHH-12492 Test HQL Delete query with a subquery re...

GitHub noreply at github.com
Fri Jul 27 09:03:02 EDT 2018


  Branch: refs/heads/master
  Home:   https://github.com/hibernate/hibernate-orm
  Commit: 48f59e891fa0186bd8d2bd0e4b4ca5cdbf5bc3a0
      https://github.com/hibernate/hibernate-orm/commit/48f59e891fa0186bd8d2bd0e4b4ca5cdbf5bc3a0
  Author: Yoann Rodière <yoann at hibernate.org>
  Date:   2018-07-27 (Fri, 27 Jul 2018)

  Changed paths:
    A hibernate-core/src/test/java/org/hibernate/test/hql/DeleteQuerySubqueryReferencingTargetPropertyTest.java

  Log Message:
  -----------
  HHH-12492 Test HQL Delete query with a subquery referencing the parent query's aliases


  Commit: dc42deafcb5267034f94b685a82f530d9c30a0af
      https://github.com/hibernate/hibernate-orm/commit/dc42deafcb5267034f94b685a82f530d9c30a0af
  Author: Yoann Rodière <yoann at hibernate.org>
  Date:   2018-07-27 (Fri, 27 Jul 2018)

  Changed paths:
    M hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/FromElement.java
    M hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/IdentNode.java
    M hibernate-core/src/test/java/org/hibernate/test/hql/DeleteQuerySubqueryReferencingTargetPropertyTest.java

  Log Message:
  -----------
  HHH-12492 Qualify references to columns from the target table in subqueries in DELETE/UPDATE queries

Don't try to duplicate the logic from
org.hibernate.hql.internal.ast.tree.FromElementType#toColumns(java.lang.String, java.lang.String, boolean, boolean)
in other classes, it's complex enough and already seems to handle all
the cases we might encounter.

In this specific case, we want the table name to be used to qualify
column names, because the target table doesn't have any alias (it's not
supported by every version of every RDBMS), and not qualifying columns
at all may lead to a confusing statement, in particular if tables
referenced in the subquery contain columns with the same name.
Since we use aliases for every other table in the query, referencing the
table should not lead to any conflict.


Compare: https://github.com/hibernate/hibernate-orm/compare/036ea775dadc...dc42deafcb52
      **NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.


More information about the hibernate-commits mailing list