简体   繁体   English

如何从数据库填充Neo4j关系类型值

[英]How to populate Neo4j relationship Types values from database

I have created Neo4j nodes in java.Now i am trying to create relationship Types but values of RelationshipType should come from Column "Interface_Name" in DB. 我已经在java.Now中创建了Neo4j节点。现在,我正在尝试创建关系类型,但是RelationshipType的值应该来自DB中的“ Interface_Name”列。 Is it possible to populate RelatioshipTypes in the Enum declaration itself? 是否可以在Enum声明本身中填充RelatioshipTypes?

public enum MyRelationshipTypes implements RelationshipType {
        KNOWS,FRNDS            //Values of Rel.Types coming from database column "Interface_Name"
        } 

Is there any way to achieve the same? 有什么办法可以达到同样的效果吗?

Please guide. 请指导。

Instead of the enum, you could use 除了枚举,您可以使用

DynamicRelationshipType.withName("value from db");

http://api.neo4j.org/2.0.1/org/neo4j/graphdb/DynamicRelationshipType.html http://api.neo4j.org/2.0.1/org/neo4j/graphdb/DynamicRelationshipType.html

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

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