簡體   English   中英

spring-data-neo4j,手動獲取relatedTo實體

[英]spring-data-neo4j, fetching relatedTo entity manully

@NodeEntity
@JsonIgnoreProperties(ignoreUnknown = true)
public class Employee {
    @GraphId
    private Long graphId;

    @Indexed
    private Long id;

    private String name;

    private String password;

    @RelatedTo(type = "REPORT_TO", direction = Direction.OUTGOING)
    private Department department;
}

我知道spring-data-neo4j可以在獲取Employee實體時使用@Fetch來獲取Department數據,但是並不是在每次獲取Employee時都需要使用Department,那么如何才能手動獲取Department? @Fetch注釋不靈活

您可以使用Neo4jTemplate#fetch (T)手動執行@Fetch自動執行的操作。

在此處查看api doc

暫無
暫無

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

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