Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2571

Criteria Builder query generates extra alias when using multiselect.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.2.3, 2.4.0
    • Fix Version/s: 2.1.2, 2.2.1.1, 2.2.3, 2.4.0
    • Component/s: criteria
    • Labels:
      None

      Description

      I have a scenario (see attached .test file) where an extra alias is generated for a query created by CriteriaBuilder. For the given test, this SQL is generated:

      SELECT t0.empl_cnt FROM
      T_FACT_WORK_ASGNMT t0, T_DIM_DAY t1, T_DIM_DAY t3
      WHERE (t0.CLNT_OBJ_ID = ? AND t1.ROLL_13_MNTH_IND = ? AND t0.pers_obj_id IN (
      SELECT t2.pers_obj_id FROM T_FACT_WORK_ASGNMT t2 WHERE
      (t2.CLNT_OBJ_ID = ? AND t3.MNTH_STRT_DAY_KY >= ?)))

      Notice that T_DIM_DAY is aliased twice.
      If I do a 'toString' on the CriteriaQuery which the test creates, and then create/execute a query using the string, the generated query is exactly like the above SQL, minus the 'T_DIM_DAY t3'. This would seem to tell me that we take a different path when creating/executing a query with a 'CriteriaQuery' as opposed to just a JPQL string.

      Thanks,

      Heath

      1. OPENJPA-2571.test
        33 kB
        Heath Thomann

        Activity

        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 1673513 from Heath Thomann in branch 'openjpa/trunk'
        [ https://svn.apache.org/r1673513 ]

        OPENJPA-2571: Criteria Builder query generates extra alias when using multiselect.

        Show
        jira-bot ASF subversion and git services added a comment - Commit 1673513 from Heath Thomann in branch 'openjpa/trunk' [ https://svn.apache.org/r1673513 ] OPENJPA-2571 : Criteria Builder query generates extra alias when using multiselect.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 1673503 from Heath Thomann in branch 'openjpa/branches/2.2.x'
        [ https://svn.apache.org/r1673503 ]

        OPENJPA-2571: Criteria Builder query generates extra alias when using multiselect.

        Show
        jira-bot ASF subversion and git services added a comment - Commit 1673503 from Heath Thomann in branch 'openjpa/branches/2.2.x' [ https://svn.apache.org/r1673503 ] OPENJPA-2571 : Criteria Builder query generates extra alias when using multiselect.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 1673497 from Heath Thomann in branch 'openjpa/branches/2.2.1.x'
        [ https://svn.apache.org/r1673497 ]

        OPENJPA-2571: Criteria Builder query generates extra alias when using multiselect.

        Show
        jira-bot ASF subversion and git services added a comment - Commit 1673497 from Heath Thomann in branch 'openjpa/branches/2.2.1.x' [ https://svn.apache.org/r1673497 ] OPENJPA-2571 : Criteria Builder query generates extra alias when using multiselect.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 1673300 from Heath Thomann in branch 'openjpa/branches/2.1.x'
        [ https://svn.apache.org/r1673300 ]

        OPENJPA-2571: Criteria Builder query generates extra alias when using multiselect.

        Show
        jira-bot ASF subversion and git services added a comment - Commit 1673300 from Heath Thomann in branch 'openjpa/branches/2.1.x' [ https://svn.apache.org/r1673300 ] OPENJPA-2571 : Criteria Builder query generates extra alias when using multiselect.

          People

          • Assignee:
            jpaheath Heath Thomann
            Reporter:
            jpaheath Heath Thomann
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development