GORM createCriteria and list do not return the same results : what can I do?

前端 未结 6 1598
名媛妹妹
名媛妹妹 2020-12-16 23:51

I am using Nimble and Shiro for my security frameworks and I\'ve just come accross a GORM bug. Indeed :

User.createCriteria().list { 
   maxResults 10 
} 
         


        
6条回答
  •  忘掉有多难
    2020-12-17 00:25

    Less concise and clear, but using an HQL query seems a way to solve this problem. As described in the Grails documentation (executeQuery section) the paginate parameters can be added as extra parameters to executeQuery.

    User.executeQuery("select distinct user from User user", [max: 2, offset: 2])
    

提交回复
热议问题