diff --git a/src/main/java/org/springframework/data/aerospike/repository/query/AerospikeQueryCreatorUtils.java b/src/main/java/org/springframework/data/aerospike/repository/query/AerospikeQueryCreatorUtils.java index 5e9575fb8..f14b58234 100644 --- a/src/main/java/org/springframework/data/aerospike/repository/query/AerospikeQueryCreatorUtils.java +++ b/src/main/java/org/springframework/data/aerospike/repository/query/AerospikeQueryCreatorUtils.java @@ -164,8 +164,10 @@ private static boolean typeDoesNotRequireConversion(Object obj, FilterOperation private static boolean isComparisonOperation(FilterOperation filterOperation) { return switch (filterOperation) { - case EQ, NOTEQ, LT, LTEQ, GT, GTEQ, BETWEEN: yield true; - default: yield false; + case EQ, NOTEQ, LT, LTEQ, GT, GTEQ, BETWEEN: + yield true; + default: + yield false; }; } @@ -243,8 +245,7 @@ protected static void validateTypes(MappingAerospikeConverter converter, Class propertyType, List queryParameters) { - return queryParameters != null - && queryParameters.size() > 0 + return !queryParameters.isEmpty() && isAssignable(Number.class, propertyType) && isAssignableValue(Number.class, queryParameters.get(0)); } diff --git a/src/main/java/org/springframework/data/aerospike/repository/query/CollectionQueryCreator.java b/src/main/java/org/springframework/data/aerospike/repository/query/CollectionQueryCreator.java index 2a28b8ccc..789ec1649 100644 --- a/src/main/java/org/springframework/data/aerospike/repository/query/CollectionQueryCreator.java +++ b/src/main/java/org/springframework/data/aerospike/repository/query/CollectionQueryCreator.java @@ -92,9 +92,7 @@ private void validateCollectionQueryComparison(List queryParameters, Str throw new IllegalArgumentException(queryPartDescription + ": invalid argument type, expecting Collection"); } - if (queryParameters.stream().anyMatch(param -> !(param instanceof List))) { - throw new IllegalArgumentException(queryPartDescription + ": only Lists can be compared"); - } + validateListType(queryParameters, queryPartDescription); } private void validateCollectionQueryBetween(List queryParameters, String queryPartDescription) { @@ -117,6 +115,10 @@ private void validateCollectionQueryBetween(List queryParameters, String "to be of the same class"); } + validateListType(queryParameters, queryPartDescription); + } + + private void validateListType(List queryParameters, String queryPartDescription) { if (queryParameters.stream().anyMatch(param -> !(param instanceof List))) { throw new IllegalArgumentException(queryPartDescription + ": only Lists can be compared"); }