简体   繁体   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;
}

I know spring-data-neo4j can use @Fetch to get Department data when get Employee entity, but not every time I need Department when get Employee, so how can I fetching department manully? 我知道spring-data-neo4j可以在获取Employee实体时使用@Fetch来获取Department数据,但是并不是在每次获取Employee时都需要使用Department,那么如何才能手动获取Department? The @Fetch annotation is not flexible @Fetch注释不灵活

You can use Neo4jTemplate#fetch (T) to do manually what @Fetch does automagically. 您可以使用Neo4jTemplate#fetch (T)手动执行@Fetch自动执行的操作。

See api doc here . 在此处查看api doc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM