Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repository methods with Iterable<Entity> are not converted to proper query and end with exception [DATAGRAPH-507] #1069

spring-projects-issues opened this issue Sep 1, 2014 · 1 comment
in: core status: declined type: bug


Copy link

@spring-projects-issues spring-projects-issues commented Sep 1, 2014

Martin Sivák opened DATAGRAPH-507 and commented

I have a repository with method:

// 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);

And calling it with HashSet<UserGroup> as the second argument ends up with the following exception:

userGroupRepository.checkMembershipInGroups(currentUser, d.getOpenFor());
// d.getOpenFor() returns Set<UserGroup> with a single element (NodeId 0).
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.aop.framework.ReflectiveMethodInvocation.proceed(
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(
	at com.sun.proxy.$Proxy116.checkMembershipInGroups(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(
	at com.sun.proxy.$Proxy117.checkMembershipInGroups(Unknown Source)
	at cz.lkbrno05.webapp.controllers.DocumentController.getDocument(

I debugged the issue and it lies in 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.

List<Long> openFor = new ArrayList<Long>();
for (UserGroup userGroup: d.getOpenFor()) {

// Boolean checkMembershipInGroups(UserGroup member, Iterable<Long> target);
userGroupRepository.checkMembershipInGroups(currentUser, openFor);

Affects: 3.1 GA (Dijkstra), 3.1.4 (Dijkstra SR4)

Copy link

@spring-projects-issues spring-projects-issues commented Sep 2, 2017

Nicolas Mervaillie commented

In order to give users a better vision of what’s happening on SDN, we are bulk closing several issues because they are no more relevant, or related to old and un-maintained SDN versions.
We tried to keep the issues that are still relevant, like feature requests that are still absent from SDN. However, some may have been closed by error. If so, please feel free to reopen.

@spring-projects-issues spring-projects-issues added type: bug status: declined in: core labels Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: core status: declined type: bug
None yet

No branches or pull requests

1 participant