Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Expect disruption to service on Thursday, Feb. 9!

SDN 6 - Custom Query with list of object as return value

I am currently trying to migrate from a previous version of SDN to SDN 6. It has been working for normal return types so far. At the moment I am stuck at trying to return a list of objects (generics) with Neo4jClient.


public List<House> getHouses(String ownerId) {
   String cypherQuery = "MATCH (h:House)-[r:OWNED_BY]-(o:Owner {id: $ownerId})"
           + " RETURN collect(DISTINCT {"
           + "   id:,"
           + "   ownerId: $ownerId,"
           + "   streetName: h.street,"
           + "   postalCode: h.postalCode"
           + "   }) as houses";
   return neo4jClient.query(cypherQuery)
          .mappedBy((typeSystem, record) -> record.get("houses").asList(r -> 


Beware that this is a simplified example and in the actual project I would like to avoid having to make a new class just to host the list of objects as its only property.

The Problem lies on line 12. What type can I put in the fetchAs() method, so it doesn't complain about the type of List that it's being given? I've tried just using "List.class" and while that works, the IDE warns me about
"Expected: List, Received: List<House>"