Spring Data JPA Pageable에서 count 쿼리는 어떻게 처리하나요?
interface BookRepository : JpaRepository<Book, Isbn>, KotlinJdslJpqlExecutor
val page: Page<Book> = bookRepository.findPage(pageable,
{ // 쿼리
select(
entity(Book::class)
).from(
entity(Book::class),
join(Book::author)
).where(
// ... 일부 조건
).groupBy(
path(Book::isbn)
)
},
{ // Count 쿼리
select(
countDistinct(path(Book::isbn))
).from(
entity(Book::class),
join(Book::author)
).where(
// ... 동일한 조건
)
}
)Last updated