How can I get a list of other entities from spring data jpa?

Viewed 26

I am looking for a way to solve the pagination and N+1 problems. (I'm using RDBMS.)

The requirements are as follows:

  • pagination process is required.
  • display the title of the group and the names of all members in the group by group in the group list.

This is an example screen. -> enter image

I tried fetch join(jpql, querydsl) and batch size method. In this way, the N+1 problem was solved, but the pagination problem was not solved.

Let me know what I should do. Thank you in advance for your reply.

[simplified java entity code]

class Member {
    String name;

    @OneToMany
    List<GroupMember> groupMembers;
}

class Group {
    String title;

    @OneToMany
    List<GroupMember> groupMembers;
}

class GroupMember {
    @ManyToOne
    Group group;
    
    @ManyToOne
    Member member;
}
0 Answers
Related