I have the following entites:
@Entity
public class Employee {
@Column
private String employeeName;
@Column
private Integer employeeId;
@OnetoMany
private Set<Account> accounts;
}
@Entity
public class Account {
@Column
private String bankName;
@Column
private Integer accountNumber;
}
public class EmployeeAccountRecords {
private String employeeName;
private Integer accountNumber;
}
I want to get paginated results of join of Employee and Account and store the value in objects of EmployeeAccountRecords class. Further I would also like to pass sorting/filter to the repository implementing this.
Can this be done without writing queries in JPQL/HQL, may be using JPA specification etc, any other components ?
I am using Spring Data JPA with Hibernate.
Thank you.
PS: result object is using only a subset of result set from the join values.