I have a list of Spring Repository methods which has grown more and more as users request additional filters. i.e., these are five example methods out of the 20 I currently have:
public interface ManagerRepository extends Repository<Manager, Long> {
List<Manager> findManagerByName(Long id);
List<Manager> findManagerByNameAndProjects(Long id, String project)
List<Manager> findManagerByNameAndPojectLike(Long id, String project)
List<Manager> findManagerByNameAndPojectStartsWith(Long id, String project)
List<Manager> findManagerByNameAndProjectLikeAndEmployeesLike(Long id, String project, String EmployeeName
}
The # of filters is seemingly endless as I get new requirements, and I don't think I'm utilizing Spring Repositories correctly in this fashion. How can I handle additional filters without creating new methods (As the current methods might be duplicated if we want to create another search for something crazy like:
findManagerByNameStartsWithAscAndProjectsLikeIgnoreCaseAndMonthStarted
(String Name, String project, String Month)