Uploaded image for project: 'Spring Data Neo4j'
  1. Spring Data Neo4j
  2. DATAGRAPH-257

QueryResultBuilder cannot be cast to java.util.Set in NodeEntity

    XMLWordPrintable

Details

    Description

      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)
      

      Attachments

        Activity

          People

            nickithewatt Nicki Watt
            mdeverdelhan Marc de Verdelhan
            Spring Issues Spring Issues
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 0.25d
                0.25d
                Remaining:
                Remaining Estimate - 0.25d
                0.25d
                Logged:
                Time Spent - Not Specified
                Not Specified