I have an entity with a lot of relationships. I cannot change them because the mapping is used in numerous parts of the code.
In only one use case, I would like to be able to load only the entities and not their relationships.
I made a simple CRUDRepository like this :
public interface EmployeeRepository extends CrudRepository<Employee, UUID> {
List<Employee> findByCompanyId(UUID companyId);
}
How can I load Employee
without their relationships without altering the mapping annotations?
I tried :
public interface EmployeeRepository extends CrudRepository<Employee, UUID> {
List<Employee> findLazyByCompanyId(UUID companyId);
}
This compiles but the entities are still not lazy loaded. I am surprised that the keyword 'Lazy' is accepted if lazy loading is not done.
Any idea?