簡體   English   中英

repository.findAll()方法在spring-data中不返回任何內容

[英]repository.findAll() method returns nothing in spring-data

我正在嘗試使用spring-data和neo4j獲得所有關系。

我的資料庫

public interface RelationshipNeo4JRepository extends
    GraphRepository<Relationship> {
}

關系類:

@RelationshipEntity
public class Relationship {

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

}

當我嘗試使用findAll()方法時,沒有任何關系。 但是我正在使用count()獲得總計。 請使用密碼查詢或其他方式幫助我。

我認為這不是您應該使用SDN存儲庫的東西。

只需轉到Neo4j API並調用:

GlobalGraphOperations.at(db).getAllRelationships();

我在存儲庫中的方法上使用@Query解決了此問題。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM