0 Replies Latest reply on Jun 5, 2010 3:03 AM by gilco

    JP-QL syntax problem with "distinct"

      Hi,

       

      I am trying to use the following expression:

       

      select SUM(distinct c.energy) from...

       

      Distinct witihn a SUM clause works in native sql and should work in JP-QL as well as far as I know.

      But I get the following error:

       

      "java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: distinct near line 1, column 33 [select distinct c.createdAt,SUM(distinct c.energy)  from..."

       

      I am using JBoss 4.2.1

      Any idea why this is not working?

       

      Thx