Implement search for JPA and Spring
In JPA you could use JpaSpecificationExecutor&lt;T&gt; in repository, with that you could utilize it's method.

TransactionRepository

public interface TransactionRepository extends JpaRepository&lt;Transaction, Long&gt;,
                                                JpaSpecificationExecutor&lt;Transaction&gt; {


}


If you look at the source of JpaSpecificationExecutor it has,


Page&lt; T &gt; findAll(@Nullable Specification&lt;T&gt; spec, Pageable pageable);



With that you just pass the specification and Pageable to return what you expected.

Specification

@AllArgsConstructor
class TransactionSpecification implements Specification&lt;Transaction&gt; {

       private TransactionFilter transactionFilter;

       @Override
        public Predicate toPredicate(Root&lt;DataImport&gt; root, CriteriaQuery&lt;?&gt; query, CriteriaBuilder criteriaBuilder) {
            // You could add multiple Predicates based on the transactionFilter
            return criteriaBuilder.equal(root.get("table_name"), "value");
        }
}


Controller

    @Autowired
    private TransactionRepository transactionRepository;

    @GetMapping
    public Page&lt;TransactionDTO&gt; find(TransactionFilterDTO filter, Pageable page) {
        TransactionFilter transactionFilter = mapper.toFilter(filter);
        return transactionRepository.findAll(new TransactionSpecification(transactionFilter), page);
    }


I am pretty late answering but you could give it a try