mongorepository@query返回java上$in、$gte、$lte的propertynotfound,仍然返回list

m3eecexj  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(248)

所以,我在mongodb中使用springboot应用程序,当我使用@query时遇到了一个问题,我得到了我想要的结果,但是我在dynatrace上得到了很多关于报告错误的日志。
使用的查询示例:

@Query("{dataInicioVigencia:{ $lte: ?0 }, dataFimDeVigencia:{ $gte: ?1 }, codigoBandeira: ?2, statusGrupoDesconto:'?3', codigoTipoCampanha: ?4}")
    List<Cupom> findByVigentesPorBandeiraTipoCampanha(Date dataInicioVigencia, Date dataFimDeVigencia, Long codigoBandeira, String statusGrupoDesconto, Long tipoCampanha);

当我调用它时,它会给出这些错误,并且仍然返回我需要的结果。

org.springframework.data.mapping.PropertyReferenceException 
Exception:
org.springframework.data.mapping.PropertyReferenceException
Message:
No property $gte found for type Cupom!
Stacktrace:
org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:80)
org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:336)
org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:312)
org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:275)
org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.getPath(QueryMapper.java:881)
org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.<init>(QueryMapper.java:770)
org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.with(QueryMapper.java:781)
org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.with(QueryMapper.java:727)
org.springframework.data.mongodb.core.convert.QueryMapper.getMappedKeyword(QueryMapper.java:278)
org.springframework.data.mongodb.core.convert.QueryMapper.getMappedObjectForField(QueryMapper.java:216)
org.springframework.data.mongodb.core.convert.QueryMapper.getMappedObject(QueryMapper.java:131)
org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1762)
org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1752)
org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:621)
org.springframework.data.mongodb.repository.query.MongoQueryExecution$CollectionExecution.execute(MongoQueryExecution.java:79)
org.springframework.data.mongodb.repository.query.MongoQueryExecution$ResultProcessingExecution.execute(MongoQueryExecution.java:411)
org.springframework.data.mongodb.repository.query.AbstractMongoQuery.execute(AbstractMongoQuery.java:94)
org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:494)
org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:477)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:56)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:57)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
com.sun.proxy.$Proxy.findByVigentesPorBandeiraTipoCampanha
sun.reflect.GeneratedMethodAccessor.invoke
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
com.sun.proxy.$Proxy.findByVigentesPorBandeiraTipoCampanha
...findByVigentesPorBandeiraETipoCampanha(CupomRepository.java:124)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题