Add support for executing derived existsBy queries.

Closes: #385
Original pull request: #386.
This commit is contained in:
Christoph Strobl
2021-07-23 07:02:04 +02:00
committed by Mark Paluch
parent 8f1c0ece24
commit 8c32f0ae6d
2 changed files with 24 additions and 0 deletions

View File

@@ -139,6 +139,8 @@ public class KeyValuePartTreeQuery implements RepositoryQuery {
Iterable<?> result = this.keyValueOperations.find(query, queryMethod.getEntityInformation().getJavaType());
return result.iterator().hasNext() ? result.iterator().next() : null;
} else if (new PartTree(queryMethod.getName(), queryMethod.getEntityInformation().getJavaType()).isExistsProjection()) {
return keyValueOperations.count(query, queryMethod.getEntityInformation().getJavaType()) > 0;
}
throw new UnsupportedOperationException("Query method not supported.");