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

Allow COUNT(*) instead of COUNT(t0.id) for simple queries as an option

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.3, 1.3.0, 2.0.0-beta
    • Component/s: None
    • Labels:
      None

      Description

      SQL generated for "select p for PObject p" is SELECT COUNT(t0.id) FROM POBJECT t0". This is valid and according to JPQL spec which does not accept COUNT.

      However, JDBC Drivers for legacy databases may not always support COUNT(columnName) as reported in [1].

      OpenJPA should support such cases with a boolean option DBDictionary.useWildCardForCount.

      [1] http://n2.nabble.com/COUNT-t-to-COUNT-tc4176827.html#a4176827

        Attachments

        1. OPENJPA-1440-1.3.x.patch.txt
          6 kB
          Heath Thomann
        2. OPENJPA-1440-1.2.x.patch.txt
          6 kB
          Heath Thomann

          Activity

            People

            • Assignee:
              ppoddar@apache.org Pinaki Poddar
              Reporter:
              ppoddar@apache.org Pinaki Poddar
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: