In clause at spring data aerospike


#1

Hi I’m using spring-data-aerospike.

When I use AerospikeRepository, the NullPointerException was occurred at in clause.

The model is like blow

@Data public class Reaction implements Serializable { @Id private String mainKey; private String postMappingId; private String userId; private String reactionType; private LocalDateTime createDate; }

And repository is like this.

public interface ReactionRepository extends AerospikeRepository<Reaction, String> { List findByUserIdIn(String… userIds); }

Then when I call above method

List userIds = Arrays.asList(“986193311515381”, “900388190060658”, “1005678696222286”);

List reactionList = repository.findByUserIdIn(userIds.toArray(new String[userIds.size()]));

The exception occurred

java.lang.NullPointerException at org.springframework.data.aerospike.repository.query.Query.addCriteria(Query.java:57) at org.springframework.data.aerospike.repository.query.Query.(Query.java:44) at org.springframework.data.aerospike.repository.query.AerospikePartTreeQuery.prepareQuery(AerospikePartTreeQuery.java:103) at org.springframework.data.aerospike.repository.query.AerospikePartTreeQuery.execute(AerospikePartTreeQuery.java:63) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:483) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:461) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:57) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) at com.sun.proxy.$Proxy46.findByUseridIn(Unknown Source)

Does not spring-data-aerospike support where In clause?


#2

Spring-data-aerospike does not currently support an “in” clause. We are looking at the possibility of using batch reads for an “in” clause for primary keys, which would suit your use case.