0
votes

I am trying to get all relationships using spring-data and neo4j.

My Repository

public interface RelationshipNeo4JRepository extends
    GraphRepository<Relationship> {
}

Relationship Class:

@RelationshipEntity
public class Relationship {

   @GraphId
   Long nodeId;
   @StartNode
   private Node startNode;
   @EndNode
   private Node endNode;
   @Indexed
   @RelationshipType
   private String type;
   //getter setter

}

When I am trying to use findAll() method, I am not getting any relationships. but I am getting total using count(). Please help me using cypher query or some other way.

2

2 Answers

0
votes

I don't think this is something you should use an SDN repository for.

Just go to the Neo4j API and call:

GlobalGraphOperations.at(db).getAllRelationships();
0
votes

I solved this using @Query on method in repository.

@Query(value="start r=rel(*) return r);
public List<Relationship> getAll();