【发布时间】:2018-03-15 21:29:29
【问题描述】:
我按照https://github.com/graphaware/neo4j-uuid 链接为从 Spring 引导应用程序创建的每个 neo4j 节点生成 UUID。 这是我按照链接执行的步骤列表:
将
graphaware-uuid-3.3.3.52.16.jar文件添加到Neo4jDB 的\plugins文件夹。
在我的情况下C:\Users\Naveen\AppData\Roaming\Neo4j Desktop\Application\neo4jDatabases\database-***\installation-3.3.2\plugins-
在 \conf\neo4j.conf 文件中添加以下配置
com.graphaware.runtime.enabled=true com.graphaware.module.UIDM.1=com.graphaware.module.uuid.UuidBootstrapper com.graphaware.module.UUID.uuidGeneratorClass=com.graphaware.module.uuid.generator.SequenceIdGenerator
-
在 Spring Boot 应用程序中创建 Model 类
@NodeEntity public class Skill { @GraphId private Long graphId; @Property(name = "uuid") private Long uuid; @Property(name = "skillName") private String skillName; //...getters and setters } -
创建 Spring Neo4j 数据仓库接口
public interface SkillRepository extends GraphRepository<Skill> { } -
启动 Neo4j DB 并加载 Spring 上下文并测试配置:
public Skill createkill() { Skill skill = new Skill(); skill.setSkillName("Java"); skill = skillRepository.save(skill); return skill; }
问题:在 Neo4j DB 中创建节点时会自动填充 graphId 属性,但未填充 uuid 属性。返回的 Skill 对象为 uuid 属性持有空值。
我检查了Graphaware Framework and UUID not starting on Neo4j GrapheneDB 和GraphAware UUID not generating 链接,但找不到任何解决我的问题的方法。
请帮忙看看我做错了什么,或者我是否遗漏了什么。
或者建议任何替代的uuid 生成解决方案。
使用的库和工具的版本详情:Java 1.8.0_131Neo4J 3.3.2 Enterprisegraphaware-uuid-3.3.3.52.16.jarSpring boot 1.5.10
【问题讨论】:
标签: neo4j uuid spring-data-neo4j graphaware