0

我在这里问了一个相关的问题。我发现像这样的正常关系实体一切正常:

@RelationshipEntity(type="REL")
public class Rel {

    @GraphId
    private Long id;
    @Fetch
    @StartNode
    private User start;
    @Fetch
    @EndNode
    private User end;

    public Rel(){}
    public Rel(User start, User end) {
        this.start = start;
        this.end = end;
    }
}

但是如果我添加一个动态关系类型,我就不能急切地加载关系。

@RelationshipEntity(type="REL")
public class Rel {

    @GraphId
    private Long id;
    @Fetch
    @StartNode
    private User start;
    @Fetch
    @EndNode
    private User end;

    // define dynamic relationship type
    // which cause the issue!!!!
    @RelationshipType
    private String type;

    public Rel(){}
    public Rel(User start, User end, String type) {
        this.start = start;
        this.end = end;
        this.type = type;
    }
}

问题是什么,如何解决?

欢迎任何帮助或建议。提前致谢!

4

1 回答 1

0
 Iterable<UserRelationEntity> rel = template.getRelationshipsBetween(user, client, UserRelationEntity.class, RelTypes.CLIENT.name());
于 2013-04-13T10:00:12.200 回答