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

Criteria Builder query generates extra alias when using multiselect.

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.2.3, 2.4.0
    • 2.1.2, 2.2.1.1, 2.2.3, 2.4.0
    • criteria
    • 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

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment