Я использую SpringBoot1.5.4
Наряду с этим у меня есть spring-data-mongodb
.Теперь я извлекаю данные из документа с помощью Json Query с пометкой @Query
.У меня есть следующая реализация: В PlayAndEarnProgramRepository
:
@Query(value="{'_id' : ?0 , 'vouchers.is_deleted' : ?1, 'vouchers.is_expired' : ?2}",fields="{'vouchers' : 1}")
public List<VouchersPAndE> getActiveVoucherByplayAndEarnId(String id,Boolean isDeleted,Boolean isExpired);
Play & Earn модель:
@Id
@Field(ID)
private String id;
@Field(PLAYANDEARNID)
private String playAndEarnId = UUID.randomUUID().toString();
@Field(MERCHANTID)
private String merchantId;
@Field(VOUCHERS)
private List<VouchersPAndE> vouchers;
И вызов repoMethod:
playAndEarnProgramRepo.getActiveVoucherByplayAndEarnId(program.getId(),false,false);
Я хочу получитьваучеры, которые являются активными.Но получаю следующее исключение:
java.lang.IllegalArgumentException: Property must not be null!
at org.springframework.util.Assert.notNull(Assert.java:134)
at com.wallet.document.PlayAndEarnProgram_Accessor_71zczn.getProperty(Unknown Source)
at org.springframework.data.mongodb.repository.query.DtoInstantiatingConverter$2.doWithPersistentProperty(DtoInstantiatingConverter.java:102)
at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:346)
at org.springframework.data.mongodb.repository.query.DtoInstantiatingConverter.convert(DtoInstantiatingConverter.java:92)
at org.springframework.data.repository.query.ResultProcessor$ChainingConverter.convert(ResultProcessor.java:212)
at org.springframework.data.repository.query.ResultProcessor$ChainingConverter$1.convert(ResultProcessor.java:200)
at org.springframework.data.repository.query.ResultProcessor$ChainingConverter.convert(ResultProcessor.java:212)
at org.springframework.data.repository.query.ResultProcessor.processResult(ResultProcessor.java:149)
at org.springframework.data.mongodb.repository.query.MongoQueryExecution$ResultProcessingConverter.convert(MongoQueryExecution.java:444)
at org.springframework.data.mongodb.repository.query.MongoQueryExecution$ResultProcessingExecution.execute(MongoQueryExecution.java:411)
at org.springframework.data.mongodb.repository.query.AbstractMongoQuery.execute(AbstractMongoQuery.java:94)
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:56)
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:213)
at com.sun.proxy.$Proxy5009.getActiveVoucherByplayAndEarnId(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Может кто-нибудь сказать мне, что я делаю неправильно?