이 3 개 요소를 감안할 때 :스프링 데이터 나머지에서 중첩 된 투영법을 반환하는 방법은 무엇입니까?
@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