I need to find an efficient and logical way to implement a search for a given entity, like Person
. Suppose that a person has name
, surname
, birthDay
, birthPlace
etc.
In my REST-API service, the client app can search people by only its name
, surname
and mixed them, so all the parameters may be optional. I don't want to make a lot of if(person.name!=null){em.setParamet(":name",person.name);
....
How can I do this in an intelligent way?