I have 3 entities
public class Student {
private Long id;
private String name;
private String gender;
private Integer age;
private List<Subject> subjects;
}
public class Subject {
private Long id;
private String description;
private List<Grade> grades;
}
public class Grade {
private Long id;
private BigDecimal value;
}
I want to generate a DTO like this:
public class StudentTransient {
private Long studentId;
private String name;
private List<SubjectTansient> subjects;
}
public class SubjectTansient {
private Long subjectId;
private List<BigDecimal> grades;
}
So in Grade class, I just wanne get the grades and group then by subject, as I want to group subjects by student.
How can I do this?
I dindt found a example like this, I used transform and GroupBy.groupBy but no achived my goal.