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

QueryResultBuilder cannot be cast to java.util.Set in NodeEntity [DATAGRAPH-257] #823

Closed
spring-projects-issues opened this issue Jun 19, 2012 · 4 comments
Labels
in: core type: bug

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Jun 19, 2012

Marc de Verdelhan opened DATAGRAPH-257 and commented

public interface CarRepository extends GraphRepository<Car> {
	@Query("start n=node({n})" +
		" match n-[:`RELATED_TO`]->car" +
		" return car" +
		" order by car.score desc")
	Set<Car> findCarsSortedByScore(@Param("n") MyNode myNode);
}

Everything works fine with the CarRepository but when I try to do this:

@NodeEntity
public class MyNode {
	@Query("start n=node({self}) match n-[:`RELATED_TO`]->car return car order by car.score desc")
	Set<Car> carsSortedByScore;
	public Set<Car> getCarsSortedByScore() {
		return this.carsSortedByScore;
	}
}

I get the following exception:

java.lang.ClassCastException: org.springframework.data.neo4j.conversion.QueryResultBuilder$1 cannot be cast to java.util.Set
       at com.mygroup.myapp.domain.MyNode.getCarsSortedByScore(MyNode.java:30)
       at com.mygroup.myapp.controller.UserController.getUserCars(UserController.java:102)
       at com.mygroup.myapp.controller.UserController$$FastClassByCGLIB$$1fe4146f.invoke(<generated>)
       at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
       at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
       at com.mygroup.myapp.common.interceptor.ExceptionInterceptor.invoke(ExceptionInterceptor.java:31)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
       at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
       at com.mygroup.myapp.controller.UserController$$EnhancerByCGLIB$$e025b4a8.getUserCars(<generated>)
       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:616)
       at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
       at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
       at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
       at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
       at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
       at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
       at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
       at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:527)
       at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1216)
       at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:369)
       at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
       at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
       at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
       at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
       at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
       at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
       at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
       at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
       at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
       at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
       at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
       at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
       at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
       at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
       at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
       at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
       at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
       at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
       at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
       at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:168)
       at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
       at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
       at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187)
       at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:421)
       at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
       at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:493)
       at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
       at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:924)
       at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:358)
       at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
       at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:860)
       at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
       at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:245)
       at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
       at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)
       at org.eclipse.jetty.server.Server.handle(Server.java:335)
       at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:588)
       at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1029)
       at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:549)
       at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:211)
       at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:418)
       at org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:489)
       at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
       at java.lang.Thread.run(Thread.java:679)

Affects: 2.1.RC1

Referenced from: pull request #189

Backported to: 3.2.1 (Evans SR1)

1 votes, 4 watchers

@spring-projects-issues
Copy link
Author

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

Michael Hunger commented

This should have been solved meanwhile, can you re-check?

@spring-projects-issues
Copy link
Author

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

Nicki Watt commented

I have checked and this is still an issue, will investigate

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Jun 8, 2014

Nicki Watt commented

Issued PR against latest 3.1 release ref #189

@spring-projects-issues
Copy link
Author

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

Aldray Low commented

Hi,

can i check if this issue is fixed? I noticed that this JIRA issue and DATAGRAPH-474 are the same problem. It is really a pain in my neck now as i need to use this feature by using @Query inside the Domain Class due to the needs to retrieve a sorted list of Object.

If this issue is not fixed, can i know if there is any other way non-official patch?

I am currently using the following:-
spring-data-aspect 3.1.4-release
neo4j 2.1.2
spring-core 4.1.0-release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: bug
Projects
None yet
Development

No branches or pull requests

1 participant