鑑於這種3個實體:如何在Spring數據庫中返回深度嵌套投影?
@Entity
class Department{
Set<Employee> employees;
Set<Employee> getEmployees(){
return this.employees;
};
}
@Entity
class Employee{
Nationality nationality;
Nationality getNationality(){
this.nationality;
}
}
@Entity
class Nationality{
}
我想創建Department
投影與他們的員工和民族返回所有部門。我已經實現是使用自己的員工返回所有部門:
@Projection(name = "fullDepartment", types = { Department.class })
public interface DepartmentsProjection {
Set<Employee> getEmployees();
}
@RepositoryRestResource(collectionResourceRel = "department", path = "departments")
public interface DepartmentRepository extends JpaRepository<Department, Long> {
}
您是否設法解決此問題? – thorinkor