I've a Class with details I want to hide. But I need to get it too. So I wrote a Projection
. But it doesn't work as it should.
I'm writing School <> Teacher (and so on) model.
public class School{//...
has a Set<Teacher>
.
This set shouldn't be visible from the 'main' path (which is School of course).
So here is the Projection
:
@Projection(name = "noTeacher", types = {School.class})
public interface SchoolNoTeacher extends ProjectionModel {
String getName();
String getSkz();
}
no getTeachers()
!
This is default in my Repository
@RepositoryRestResource(path = "school", excerptProjection = SchoolNoTeacher.class)
public interface SchoolRepository extends PagingAndSortingRepository<School, Long> {//...
But I want to handle the rest path myself. So I've a controller too.
@RestController
@RequestMapping(ScoolModel.api + "/school")
public class SchoolRestController {//...
And the Projection is not working. Any way to fix it?