Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-5573

DISTINCT does not work with aggregate functions in JPQL

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 10.0.0.CR2
    • JPA / Hibernate
    • None

      The JPQL: SELECT SUM(DISTINCT df.fileSize) from Datafile df is, I believe, valid but is rejected with: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: DISTINCT near line 1, column 14 [SELECT SUM ( DISTINCT df.fileSize ) FROM org.icatproject.core.entity.Datafile df]
      I see that the documentation only states that COUNT(DISTINCT .. will work. However all the aggregate functions should accept the DISTINCT keyword.

              smarlow1@redhat.com Scott Marlow
              fisherab Steve Fisher (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: