我问了一个相关的问题here。我发现像这样的普通关系实体一切正常:
@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;
}
}
问题是什么,以及如何解决?
欢迎任何帮助或建议。提前谢谢!
答案 0 :(得分:0)
Iterable<UserRelationEntity> rel = template.getRelationshipsBetween(user, client, UserRelationEntity.class, RelTypes.CLIENT.name());