When the below URL is visited, I get paginations in response
/api/userPosts/
{
"_links" : {
"self" : {
"href" : "/api/userPosts{?page,size,sort}",
"templated" : true
},
"next" : {
"href" : api/userPosts?page=1&size=20{&sort}",
"templated" : true
}
},
"_embedded" : {
"userPosts" : [ {
...
However when visiting following URL, there is no pagination out of box by Spring Data REST -
/api/users/4/userPosts
{
"_embedded" : {
"userPosts" : [ {
Both UserRepository and UserPostRepository are JPARepository with pagination. As a result, the second URL is throwing GC overhead exceeded error since the row count for results returned is huge.
@RepositoryRestResource(excerptProjection = UserProjection.class)
public interface UserRepository extends BaseRepository<User, Integer>, UserRepositoryCustom {
}
public interface UserPostRepository extends BaseRepository<UserPost, Long> {
}
@NoRepositoryBean
public interface BaseRepository<T, N extends Serializable> extends JpaRepository<T, N>, QueryDslPredicateExecutor<T> {
}
Any way to have pagination with second URL as well ?