If I have understood right, in domain driven design there are repositories for only aggregate root objects. So what is the right way to implement, for example, paging (or access control filtering) for those objects which are child objects of roots.
Example:
@Entity
public class Person extends AbstractPersistable<Long> {
@OneToMany
private List<Competence> competences = new ArrayList<>();
public void addCompetence( Competence competence ) {
this.competences.add( competence );
}
public List<Competences> competences() {
return this.competences;
}
}
So if I first get person object from repository and then I'd like to send subset (page) of competences to my front end? It not make sense to create CompetenceRepository to find competences by person because it brokes the whole idea of aggregate roots... For now I have used Spring Data JPA.