I am trying to implement the service for a rest controller that takes optional filter parameters like first name, last name, age, etc. I want to use a JpaRepository method like below. The problem is, if a parameter is null then no records are found.
When a argument is null i do not want filtering to occur on that field. Is there a way to implement this out of the box with JpaRepository?
Page<Customer> findByLastNameAndByFirstNameAndByAge(String lastName, String firstName, int age, Pageable pageable);