开发者

how to use count distinct with namedQueries in grails?

开发者 https://www.devze.com 2023-02-14 21:12 出处:网络
I have this : class Contribution { 开发者_高级运维 String name ... static namedQueries{ findAllByName{

I have this :

class Contribution {
 开发者_高级运维 String name
  ...
  static namedQueries{
     findAllByName{
         'in' "name", ['bla','bla','fafa','fofo']
     }
  }
}

I use the method listDistinct and it's right. But for pagination I need to have the totalCount.

How to do that ?

Thanks.


Is it OK to add distinct to the named query? Like

  static namedQueries{
     findAllByName{
         'in' "name", ['bla','bla','fafa','fofo']
          projections {
            groupProperty("name")
          }
     }
  }
0

精彩评论

暂无评论...
验证码 换一张
取 消