Case..When in Where Condition Spring boot data jpa

194 views Asked by At

Is there any way can we make case with where condition??

I need to search users based on first name,last name, role....etc but in search params all params are not mandatory, User may enter only firstname or with combination of multiple params..

Using - Springboot data jpa with PostgreSQL

Thanks in advance.

1

There are 1 answers

1
Tarun Singh Rawat On

At the time when values are entered for search, get all of that data inside an array, then take that array and pass those values one by one to db (applied in a loop) and retrieve all of the data accordingly and apply those fields in search