fireball.1
fireball.1

Reputation: 1521

Spring JPA query with only one argument case insensitive while having multiple arguments

I am trying to write a spring boot query(with mongoDb) in the repository where I want one of the arguments needs to be case insensitive
I can use something like this but then personId also becomes case insensitive and it does not allow the Boolean argument.

public Family findByNameAndPersonIdAndActiveIgnoreCase(String name, String personId, Boolean active);

A compound query or some annotation should also work.

Upvotes: 1

Views: 904

Answers (1)

Ryuzaki L
Ryuzaki L

Reputation: 39978

Just specify the IgnoreCase to only the property that need case insensitive

public Family findByNameIgnoreCaseAndPersonIdAndActive(String name, String personId, Boolean active);

Upvotes: 2

Related Questions