org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement START a=node({0}), t=node({1}) MATCH path=a -[:PROVIDE_MEMBERS*0..]-> t RETURN count(path) > 0; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement START a=node({0}), t=node({1}) MATCH path=a -[:PROVIDE_MEMBERS*0..]-> t RETURN count(path) > 0; nested exception is scala.MatchError: cz.lkbrno05.entities.User@0 (of class cz.lkbrno05.entities.User)

Spring JIRA | Martin Sivák | 2 years ago
  1. 0

    I have a repository with method: {code:title="UserGroupRepository.java"} // User extends UserGroup @Query("START a=node({0}), t=node({1}) MATCH path=a -[:PROVIDE_MEMBERS*0..]-> t RETURN count(path) > 0") Boolean checkMembershipInGroups(UserGroup member, Iterable<UserGroup> target); {code} And calling it with HashSet<UserGroup> as the second argument ends up with the following exception: {code:title="call"} userGroupRepository.checkMembershipInGroups(currentUser, d.getOpenFor()); // d.getOpenFor() returns Set<UserGroup> with a single element (NodeId 0). {code} {code:title="exception"} org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement START a=node({0}), t=node({1}) MATCH path=a -[:PROVIDE_MEMBERS*0..]-> t RETURN count(path) > 0; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement START a=node({0}), t=node({1}) MATCH path=a -[:PROVIDE_MEMBERS*0..]-> t RETURN count(path) > 0; nested exception is scala.MatchError: cz.lkbrno05.entities.User@0 (of class cz.lkbrno05.entities.User) at org.springframework.data.neo4j.support.query.CypherQueryEngineImpl.query(CypherQueryEngineImpl.java:61) at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.dispatchQuery(GraphRepositoryQuery.java:117) at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery$1.doWithGraph(GraphRepositoryQuery.java:88) at org.springframework.data.neo4j.support.Neo4jTemplate.doExecute(Neo4jTemplate.java:456) at org.springframework.data.neo4j.support.Neo4jTemplate.access$000(Neo4jTemplate.java:86) at org.springframework.data.neo4j.support.Neo4jTemplate$2.doInTransaction(Neo4jTemplate.java:470) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at org.springframework.data.neo4j.support.Neo4jTemplate.exec(Neo4jTemplate.java:467) at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.execute(GraphRepositoryQuery.java:82) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:384) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:344) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy116.checkMembershipInGroups(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201) at com.sun.proxy.$Proxy117.checkMembershipInGroups(Unknown Source) at cz.lkbrno05.webapp.controllers.DocumentController.getDocument(DocumentController.java:425) {code} I debugged the issue and it lies in *org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.convertGraphEntityToId* which is supposed to convert entities to NodeIds. But it does not know how to process Iterables. Everything worked properly when I converted my method to use Iterable<Long> and passed precomputed Set of NodeIds to it. {code:title="Working call"} List<Long> openFor = new ArrayList<Long>(); for (UserGroup userGroup: d.getOpenFor()) { openFor.add(userGroup.getNodeId()); } // Boolean checkMembershipInGroups(UserGroup member, Iterable<Long> target); userGroupRepository.checkMembershipInGroups(currentUser, openFor); {code}

    Spring JIRA | 2 years ago | Martin Sivák
    org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement START a=node({0}), t=node({1}) MATCH path=a -[:PROVIDE_MEMBERS*0..]-> t RETURN count(path) > 0; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement START a=node({0}), t=node({1}) MATCH path=a -[:PROVIDE_MEMBERS*0..]-> t RETURN count(path) > 0; nested exception is scala.MatchError: cz.lkbrno05.entities.User@0 (of class cz.lkbrno05.entities.User)
  2. 0

    I have a repository with method: {code:title="UserGroupRepository.java"} // User extends UserGroup @Query("START a=node({0}), t=node({1}) MATCH path=a -[:PROVIDE_MEMBERS*0..]-> t RETURN count(path) > 0") Boolean checkMembershipInGroups(UserGroup member, Iterable<UserGroup> target); {code} And calling it with HashSet<UserGroup> as the second argument ends up with the following exception: {code:title="call"} userGroupRepository.checkMembershipInGroups(currentUser, d.getOpenFor()); // d.getOpenFor() returns Set<UserGroup> with a single element (NodeId 0). {code} {code:title="exception"} org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement START a=node({0}), t=node({1}) MATCH path=a -[:PROVIDE_MEMBERS*0..]-> t RETURN count(path) > 0; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement START a=node({0}), t=node({1}) MATCH path=a -[:PROVIDE_MEMBERS*0..]-> t RETURN count(path) > 0; nested exception is scala.MatchError: cz.lkbrno05.entities.User@0 (of class cz.lkbrno05.entities.User) at org.springframework.data.neo4j.support.query.CypherQueryEngineImpl.query(CypherQueryEngineImpl.java:61) at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.dispatchQuery(GraphRepositoryQuery.java:117) at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery$1.doWithGraph(GraphRepositoryQuery.java:88) at org.springframework.data.neo4j.support.Neo4jTemplate.doExecute(Neo4jTemplate.java:456) at org.springframework.data.neo4j.support.Neo4jTemplate.access$000(Neo4jTemplate.java:86) at org.springframework.data.neo4j.support.Neo4jTemplate$2.doInTransaction(Neo4jTemplate.java:470) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at org.springframework.data.neo4j.support.Neo4jTemplate.exec(Neo4jTemplate.java:467) at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.execute(GraphRepositoryQuery.java:82) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:384) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:344) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy116.checkMembershipInGroups(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201) at com.sun.proxy.$Proxy117.checkMembershipInGroups(Unknown Source) at cz.lkbrno05.webapp.controllers.DocumentController.getDocument(DocumentController.java:425) {code} I debugged the issue and it lies in *org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.convertGraphEntityToId* which is supposed to convert entities to NodeIds. But it does not know how to process Iterables. Everything worked properly when I converted my method to use Iterable<Long> and passed precomputed Set of NodeIds to it. {code:title="Working call"} List<Long> openFor = new ArrayList<Long>(); for (UserGroup userGroup: d.getOpenFor()) { openFor.add(userGroup.getNodeId()); } // Boolean checkMembershipInGroups(UserGroup member, Iterable<Long> target); userGroupRepository.checkMembershipInGroups(currentUser, openFor); {code}

    Spring JIRA | 2 years ago | Martin Sivák
    org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement START a=node({0}), t=node({1}) MATCH path=a -[:PROVIDE_MEMBERS*0..]-> t RETURN count(path) > 0; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement START a=node({0}), t=node({1}) MATCH path=a -[:PROVIDE_MEMBERS*0..]-> t RETURN count(path) > 0; nested exception is scala.MatchError: cz.lkbrno05.entities.User@0 (of class cz.lkbrno05.entities.User)
  3. 0

    Neo4j 2.2.2 and wrong Cypher query

    Stack Overflow | 1 year ago | alexanoid
    org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement MATCH (d:Decision) WHERE id(d) IN {decisionsIds} WITH d OPTIONAL MATCH (d)-[r]-(t) DELETE d, r WITH t, r OPTIONAL MATCH (t)-[r2:VOTED_ON|:CREATED_BY|:VOTED_FOR]-() WITH t, r2, r WHERE none(x in labels(t) WHERE x in ['User', 'Decision']) DELETE t, r2; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement MATCH (d:Decision) WHERE id(d) IN {decisionsIds} WITH d OPTIONAL MATCH (d)-[r]-(t) DELETE d, r WITH t, r OPTIONAL MATCH (t)-[r2:VOTED_ON|:CREATED_BY|:VOTED_FOR]-() WITH t, r2, r WHERE none(x in labels(t) WHERE x in ['User', 'Decision']) DELETE t, r2; nested exception is org.neo4j.kernel.api.exceptions.EntityNotFoundException: Unable to load NODE with id 227.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Spring-Data-Neo4j annotated Cypher Query, match paramter

    Stack Overflow | 2 years ago
    org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement START n=node(*) MATCH (n:{0}) RETURN n; nested exception is Invalid input '{': expected whitespace or a label name (line 1, column 26) "START n=node(*) MATCH (n:{0}) RETURN n"
  6. 0

    problem using @query in spring neo4j

    GitHub | 3 years ago | Amitosh1
    org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement start n=node({0}) match (n)-[r]->(inbox) where r.relation in {1} return inbox ; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement start n=node({0}) match (n)-[r]->(inbox) where r.relation in {1} return inbox ; nested exception is expected return clause "start n=node({0}) match (n)-[r]->(inbox) where r.relation in {1} return inbox " ^

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.springframework.dao.InvalidDataAccessResourceUsageException

      Error executing statement START a=node({0}), t=node({1}) MATCH path=a -[:PROVIDE_MEMBERS*0..]-> t RETURN count(path) > 0; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement START a=node({0}), t=node({1}) MATCH path=a -[:PROVIDE_MEMBERS*0..]-> t RETURN count(path) > 0; nested exception is scala.MatchError: cz.lkbrno05.entities.User@0 (of class cz.lkbrno05.entities.User)

      at org.springframework.data.neo4j.support.query.CypherQueryEngineImpl.query()
    2. Spring Data Neo4j
      Neo4jTemplate$2.doInTransaction
      1. org.springframework.data.neo4j.support.query.CypherQueryEngineImpl.query(CypherQueryEngineImpl.java:61)
      2. org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.dispatchQuery(GraphRepositoryQuery.java:117)
      3. org.springframework.data.neo4j.repository.query.GraphRepositoryQuery$1.doWithGraph(GraphRepositoryQuery.java:88)
      4. org.springframework.data.neo4j.support.Neo4jTemplate.doExecute(Neo4jTemplate.java:456)
      5. org.springframework.data.neo4j.support.Neo4jTemplate.access$000(Neo4jTemplate.java:86)
      6. org.springframework.data.neo4j.support.Neo4jTemplate$2.doInTransaction(Neo4jTemplate.java:470)
      6 frames
    3. Spring Tx
      TransactionTemplate.execute
      1. org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
      1 frame
    4. Spring Data Neo4j
      GraphRepositoryQuery.execute
      1. org.springframework.data.neo4j.support.Neo4jTemplate.exec(Neo4jTemplate.java:467)
      2. org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.execute(GraphRepositoryQuery.java:82)
      2 frames
    5. Spring Data Core
      RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke
      1. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:384)
      2. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:344)
      2 frames
    6. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      1 frame
    7. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
      2. org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
      3. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
      3 frames
    8. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      1 frame
    9. Spring Tx
      PersistenceExceptionTranslationInterceptor.invoke
      1. org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
      1 frame
    10. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
      2 frames
    11. com.sun.proxy
      $Proxy116.checkMembershipInGroups
      1. com.sun.proxy.$Proxy116.checkMembershipInGroups(Unknown Source)
      1 frame
    12. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:606)
      4 frames
    13. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201)
      2 frames
    14. com.sun.proxy
      $Proxy117.checkMembershipInGroups
      1. com.sun.proxy.$Proxy117.checkMembershipInGroups(Unknown Source)
      1 frame
    15. cz.lkbrno05.webapp
      DocumentController.getDocument
      1. cz.lkbrno05.webapp.controllers.DocumentController.getDocument(DocumentController.java:425)
      1 frame