Arian
Arian

Reputation: 7719

Spring repository: find by a field with two conditions

I want to find all Users with name like ?1% which are not in a passed in list ?2:

I use this method name: findByNameStartingWithAndNotIn but I get this error:

No property notIn found for type User!

Does it mean that I have to write my own custom SQL?

Upvotes: 1

Views: 580

Answers (1)

jbx
jbx

Reputation: 22128

Spring data does not know that you want to use Name for the second clause too.

Just specify it separately, try:

List<User> findByNameStartingWithAndNameNotIn(String prefix, List<String> namesToExclude)

Upvotes: 4

Related Questions