I have about 20000 odd nodes and relationships in my neo4j schema. I am trying to query that data and display in my browser. I am using the neo-4j java driver with Spring jdbcTemplate. But below query MATCH(n)<-[r]-(m) return n,type(r),m limit 100
final String GRAPH_QUERY = "MATCH(n)<-[r]-(m) return n,type(r),m limit 100";
Iterator<Map<String, Object>> result = template.queryForList(
GRAPH_QUERY, limit == null ? 100 : limit).iterator();
while ( result.hasNext() )
{
//store result in a hashmap or something
}
//There is only one row returned in the result above.
it is returning only one row in Java, whereas this same query returns all the nodes and relationships if i run it in neo4j shell or from console. Pretty strange. Any reasons ?
pom.xml dependencies
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-jdbc</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.1</version>
</dependency>
There is nothing much to the code apart from what I have posted above. If I iterate using the result iterator , its giving me only one result.