java - MappingException: Invalid path reference club.name! Associations can only be pointed to directly or via their id property -


i'm using spring data mongodb library , don't know find @query element in 2 collections joined @dbref, this:

user:

@document public class user {  @id @jsonserialize(using=objectidserializer.class) private objectid id;  @createddate private date datecreated = new date();  @lastmodifieddate private date datemodified = new date();  @notempty @indexed private string name;  @language private string lang;  @notempty @dbref private club club; ... 

club:

@document public class club {  @id @jsonserialize(using=objectidserializer.class) private objectid id;  @indexed(unique = true) private string name;  private address address; ... 

userrepository:

@query("{\"$or\":"             + "["                 + "{\"name\" : {\"$regex\" : ?0, \"$options\": \"i\"}}, "                 + "{\"club.name\" : {\"$regex\" : ?0, \"$options\": \"i\"}} "             + "]"         + "}") public page<user> findall(string query, pageable pageable); 

error:

org.springframework.web.util.nestedservletexception: request processing failed; nested exception org.springframework.data.mapping.model.mappingexception: invalid path reference club.name! associations can pointed directly or via id property! @ org.springframework.web.servlet.frameworkservlet.processrequest(frameworkservlet.java:980) @ org.springframework.web.servlet.frameworkservlet.doget(frameworkservlet.java:859) @ javax.servlet.http.httpservlet.service(httpservlet.java:622) @ org.springframework.web.servlet.frameworkservlet.service(frameworkservlet.java:844) @ org.springframework.test.web.servlet.testdispatcherservlet.service(testdispatcherservlet.java:65) @ javax.servlet.http.httpservlet.service(httpservlet.java:729) @ org.springframework.mock.web.mockfilterchain$servletfilterproxy.dofilter(mockfilterchain.java:167) @ org.springframework.mock.web.mockfilterchain.dofilter(mockfilterchain.java:134) @ org.springframework.test.web.servlet.mockmvc.perform(mockmvc.java:155) @ it.stasbranger.rotarylive.controller.usercontrollertests.showusersfiltertest3(usercontrollertests.java:137) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:498) @ org.junit.runners.model.frameworkmethod$1.runreflectivecall(frameworkmethod.java:50) @ org.junit.internal.runners.model.reflectivecallable.run(reflectivecallable.java:12) @ org.junit.runners.model.frameworkmethod.invokeexplosively(frameworkmethod.java:47) @ org.junit.internal.runners.statements.invokemethod.evaluate(invokemethod.java:17) @ org.junit.internal.runners.statements.runbefores.evaluate(runbefores.java:26) @ org.springframework.test.context.junit4.statements.runbeforetestmethodcallbacks.evaluate(runbeforetestmethodcallbacks.java:75) @ org.springframework.test.context.junit4.statements.runaftertestmethodcallbacks.evaluate(runaftertestmethodcallbacks.java:86) @ com.lordofthejars.nosqlunit.core.abstractnosqltestrule$1.evaluate(abstractnosqltestrule.java:72) @ org.springframework.test.context.junit4.statements.springrepeat.evaluate(springrepeat.java:84) @ org.junit.runners.parentrunner.runleaf(parentrunner.java:325) @ org.springframework.test.context.junit4.springjunit4classrunner.runchild(springjunit4classrunner.java:254) @ org.springframework.test.context.junit4.springjunit4classrunner.runchild(springjunit4classrunner.java:89) @ org.junit.runners.parentrunner$3.run(parentrunner.java:290) @ org.junit.runners.parentrunner$1.schedule(parentrunner.java:71) @ org.junit.runners.parentrunner.runchildren(parentrunner.java:288) @ org.junit.runners.parentrunner.access$000(parentrunner.java:58) @ org.junit.runners.parentrunner$2.evaluate(parentrunner.java:268) @ org.springframework.test.context.junit4.statements.runbeforetestclasscallbacks.evaluate(runbeforetestclasscallbacks.java:61) @ org.springframework.test.context.junit4.statements.runaftertestclasscallbacks.evaluate(runaftertestclasscallbacks.java:70) @ org.junit.rules.externalresource$1.evaluate(externalresource.java:48) @ org.junit.rules.runrules.evaluate(runrules.java:20) @ org.junit.runners.parentrunner.run(parentrunner.java:363) @ org.springframework.test.context.junit4.springjunit4classrunner.run(springjunit4classrunner.java:193) @ org.eclipse.jdt.internal.junit4.runner.junit4testreference.run(junit4testreference.java:86) @ org.eclipse.jdt.internal.junit.runner.testexecution.run(testexecution.java:38) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:459) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:675) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.run(remotetestrunner.java:382) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.main(remotetestrunner.java:192) caused by: org.springframework.data.mapping.model.mappingexception: invalid path reference club.name! associations can pointed directly or via id property! @ org.springframework.data.mongodb.core.convert.querymapper$metadatabackedfield.getpath(querymapper.java:853) @ org.springframework.data.mongodb.core.convert.querymapper$metadatabackedfield.(querymapper.java:729) @ org.springframework.data.mongodb.core.convert.querymapper$metadatabackedfield.(querymapper.java:706) @ org.springframework.data.mongodb.core.convert.querymapper.createpropertyfield(querymapper.java:216) @ org.springframework.data.mongodb.core.convert.querymapper.getmappedobject(querymapper.java:122) @ org.springframework.data.mongodb.core.convert.querymapper.getmappedkeyword(querymapper.java:235) @ org.springframework.data.mongodb.core.convert.querymapper.getmappedobject(querymapper.java:100) @ org.springframework.data.mongodb.core.mongotemplate.count(mongotemplate.java:724) @ org.springframework.data.mongodb.repository.query.abstractmongoquery$pagedexecution.execute(abstractmongoquery.java:268) @ org.springframework.data.mongodb.repository.query.abstractmongoquery.execute(abstractmongoquery.java:106) @ org.springframework.data.repository.core.support.repositoryfactorysupport$queryexecutormethodinterceptor.doinvoke(repositoryfactorysupport.java:462) @ org.springframework.data.repository.core.support.repositoryfactorysupport$queryexecutormethodinterceptor.invoke(repositoryfactorysupport.java:440) @ org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:179) @ org.springframework.data.projection.defaultmethodinvokingmethodinterceptor.invoke(defaultmethodinvokingmethodinterceptor.java:61) @ 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.aop.framework.jdkdynamicaopproxy.invoke(jdkdynamicaopproxy.java:208) @ com.sun.proxy.$proxy132.findall(unknown source) @ it.stasbranger.rotarylive.service.userserviceimpl.findall(userserviceimpl.java:71) @ it.stasbranger.rotarylive.controller.usercontroller.showusers(usercontroller.java:53) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:498) @ org.springframework.web.method.support.invocablehandlermethod.doinvoke(invocablehandlermethod.java:221) @ org.springframework.web.method.support.invocablehandlermethod.invokeforrequest(invocablehandlermethod.java:136) @ org.springframework.web.servlet.mvc.method.annotation.servletinvocablehandlermethod.invokeandhandle(servletinvocablehandlermethod.java:110) @ org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter.invokehandlermethod(requestmappinghandleradapter.java:817) @ org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter.handleinternal(requestmappinghandleradapter.java:731) @ org.springframework.web.servlet.mvc.method.abstracthandlermethodadapter.handle(abstracthandlermethodadapter.java:85) @ org.springframework.web.servlet.dispatcherservlet.dodispatch(dispatcherservlet.java:959) @ org.springframework.web.servlet.dispatcherservlet.doservice(dispatcherservlet.java:893) @ org.springframework.web.servlet.frameworkservlet.processrequest(frameworkservlet.java:968) ... 42 more

it not possible query on dbref in mongodb itself. not possible using spring data mongodb. resulting error clear in message "associations can pointed directly or via id property!"


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -