'Pagination with Grails/GORM/DataServices @Query annotation

How do you add pagination when using GORM JPA-QL Queries via the grails.gorm.services.Query annotation

@Service(User)
abstract class UserDataService implements IUserService {

    @Query($/SELECT DISTINCT new Map(user.id as id, user.username as username)
             FROM $User user
              join $UserRelationship ur on ur.user.id = user.id or ur.manager.id = user.id
              join ur.manager manager
           /$)
   abstract List<Map> searchAllUsers(String searchString, [offset: 0, max: 10])

}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source