Enable KeyValuePartTreeQuery usage for projections.

Closes #563
This commit is contained in:
Mark Paluch
2024-02-20 11:16:22 +01:00
parent 3a6e235d4b
commit b96f591fcc
2 changed files with 30 additions and 5 deletions

View File

@@ -134,15 +134,13 @@ public class KeyValuePartTreeQuery implements RepositoryQuery {
} else if (queryMethod.isCollectionQuery()) {
return this.keyValueOperations.find(query, queryMethod.getEntityInformation().getJavaType());
} else if (queryMethod.isQueryForEntity()) {
} else if (partTree.get().isExistsProjection()) {
return keyValueOperations.exists(query, queryMethod.getEntityInformation().getJavaType());
} else {
Iterable<?> result = this.keyValueOperations.find(query, queryMethod.getEntityInformation().getJavaType());
return result.iterator().hasNext() ? result.iterator().next() : null;
} else if (partTree.get().isExistsProjection()) {
return keyValueOperations.exists(query, queryMethod.getEntityInformation().getJavaType());
}
throw new UnsupportedOperationException("Query method not supported");
}
protected KeyValueQuery<?> prepareQuery(Object[] parameters) {