title: Returning objects of different types from Neo4j with Spring Data?
body: <p>Does anyone know how to return a collection of different objects mapped from Neo4j nodes within a Spring-Data-Neo4j graph repository?</p>
  
  <p>If I have a repository like this:</p>
  
  <pre><code>interface JunctionGraph extends GraphRepository&lt;Junction&gt;, SpatialRepository&lt;Junction&gt; {
      @Query("MATCH (a) WHERE a.name={0} RETURN a")
      Collection&lt;Object&gt; findAllWithName(String name)
  }
  </code></pre>
  
  <p>what like to see is <strong>findAllWithName</strong> returning a list of all the different mapped objects that have the specified name. Instead I just get a collect of <strong>Node</strong>s. How do I persuade SDN to map all the nodes into the right object type?</p>