JPA findBy field ignore case

Daria Bulanova picture Daria Bulanova · May 30, 2016 · Viewed 22.3k times · Source

How do I make findByIn search using IgnoreCase of <Field>? I tried to use findByNameIgnoreCaseIn and findByNameInIgnoreCase with no result. DB is Postgresql.

@Repository
public interface UserRepository {
    List<User> findByNameIgnoreCaseIn(List<String> userNames);
}

Answer

Sumeet Tiwari picture Sumeet Tiwari · May 31, 2016

Try something like this:

List<User> findByNameInIgnoreCase(List<String> userNames);