I need 4 filtering options to get a list.
so I used findBy~And~ method in SpringBoot JPA.
But when some filterings is not applied, null data is passed.
so from the code below,
mysql proceed query like select ~ where branch="" which returns 0 row where it should return all the columns,,,,since branch filter is not applied.
SO I want it to ignore the parameter when it's null dynamically or not sending the parameter at all.
please kindly help !
service page :
Page<ReviewModel> reviewList = this.reviewRepository.findByBranchAndSexAndAgeRangeAndPurpose(request.getBranch(), request.getSex(), request.getAgeRange(), request.getPurpose(), pageable);
repository page:
Page<ReviewModel> findByBranchAndSexAndAgeRangeAndPurpose(String branch, String sex, String ageRange, String purpose, Pageable pageable);