0

I'm doing a React + Springboot application. In some part of the app I have a four selectors and a button to search("Buscar"). Like this

What I'm trying to do is a conditional query depending on which values are selected. With this code below I can do the query if all the values are filled but if some is missing it throws an error ( Current Query )

I think it may be with the Specifiaction or something like that not sure yet

1
  • Please include all the information for your question in the question, do not hide them behind links. Commented Oct 6, 2022 at 8:14

1 Answer 1

0

You can create custom queries in spring data jpa using specifications

Here you conditionally add create criteria queries.
ref:

https://reflectoring.io/spring-data-specifications/

https://spring.io/blog/2011/04/26/advanced-spring-data-jpa-specifications-and-querydsl/

This can help you with all your custom permutations and combinations.

Sign up to request clarification or add additional context in comments.

1 Comment

y, im trying that but i run into the same problem, do I have to create 24 IF condition to evaluate every combination? Or theres some way that Specification can resolve it?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.