是否可以使用 arangodb-spring-data 在边缘添加不同的集合

Is there an option to add different collection in edge using arangodb-spring-data

在 arangoDB 中,我们可以创建一条边,在其中我们可以将 @from 和 @to 设置为不同的集合,因为这些都是 json 数据。在 ArangoDB-Spring-Data 库中,我们可以创建一条边,我们必须为 @from 和 @to 提供类型。我想使用相同的边添加不同集合之间的关系。例如- 我有一个 class EntitywithKey-

public class EntityWithKey {
     @Id
     protected String id;
}

我有 2 个 class 扩展了 EntityWIthKey

@Document("actors")
@HashIndex(fields = { "name", "surname" }, unique = true)
public class Actor extends EntityWithKey{
     private String name;
     private String surname;
}

@Document("characters")
@HashIndex(fields = { "name", "surname" }, unique = true)
public class Character extends EntityWithKey {
     private String name;
     private String surname;
}

我想创建如下边-

@Edge
public class ChildOf {
     @Id
     private String id;
     @From
     private EntityWithKey child;
     @To
     private EntityWithKey parent;
}

这样我就可以添加演员-演员、演员-角色、角色-角色和角色-演员之间的关系。

但是我看到一个错误 nested exception is org.springframework.data.mapping.PropertyReferenceException: No property name found for type EntityWithKey!

这个库是否有任何选项可以做到这一点?

我已经解决了这个问题。必须使用 java generics-

创建边缘
@Edge
public class ChildOf<T1,T2> {
     @Id
     private String id;
     @From
     private T1 child;
     @To
     private T2 parent;
}

现在我可以在单边关系中添加任意两个连接器