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

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


  Branch: refs/heads/5.3
  Home:   https://github.com/hibernate/hibernate-orm
  Commit: 6cf91c832c71e23a951460b1daa23ce04e2ca9fd
      https://github.com/hibernate/hibernate-orm/commit/6cf91c832c71e23a951460b1daa23ce04e2ca9fd
  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: b8b7a0f19b2a32a436cedfd6c3632b3d9c0d7ac6
      https://github.com/hibernate/hibernate-orm/commit/b8b7a0f19b2a32a436cedfd6c3632b3d9c0d7ac6
  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/77661b227581...b8b7a0f19b2a
      **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