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.
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();
I solved this using @Query on method in repository.
@Query(value="start r=rel(*) return r);
public List<Relationship> getAll();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.