Guilherme Barbosa
Guilherme Barbosa

Reputation: 5

Dynamic filters in Spring Boot query

I want to make a dynamic filter only query using Spring Boot and JPA with a SQL Database, but I don't know what to do.

We are doing one query for each filter, but that way is a bad way. So we need one query for all filters.

How do I do it?

Upvotes: 0

Views: 1461

Answers (1)

AYOUB_MA
AYOUB_MA

Reputation: 48

You can use the old and popular CriteriaBuilder or use the most sophisticated Specification concept in Spring Data JPA, or you can use the implementation of QueryDSL which give you better efficient way. All of them can make your life easy by given you a dynamic programmatically way to gemerate your filter in Runtime.

Upvotes: 1

Related Questions