Grails groupProperty and order. How it works?

I have this domain:

class Participation { ParticipationStatus status } class ParticipationStatus{ String name Date creationDate } 

I create a query:

 Participation.createCriteria().list{ createAlias("status","statusAlias") order "statusAlias.creationDate" projections{ groupProperty "id" } } 

But I got an error message: Called: java.sql.SQLException: ORA-00979: expression N'est pas une GROUP BY

I work 2 days ago for this request grrrr !; -)

thanks a lot

+4
source share
1 answer

Each field that you use in aggregate queries (the one that uses projections ) must be either groupProperty , or just an argument to an aggregate function (that is, in projections anyway). In this example, try

 Participation.createCriteria().list{ createAlias("status","statusAlias") order "statusAlias.creationDate" projections{ groupProperty "id" groupProperty "statusAlias.creationDate" } } 
+8
source

Source: https://habr.com/ru/post/1342636/


All Articles