У меня есть три доменных класса Author, Comment и Book:
class Author {
String name
static hasMany = [books: Book, comments: Comment]
}
class Book {
static belongsTo = [author: Author]
static hasMany = [comments: Comment]
}
class Comment {
static belongsTo = [book: Book, author: Author]
}
У меня есть следующий запрос mongoDB, чтобы найти все книги, в которых есть комментарии от данного автора.
Comment.findAllByAuthor(author1).collect {
it.book
}.unique().findAll {
it != null
}
Как я могу использовать разбиение на страницы для этого запроса, т. е. разбивать на страницы все книги?