Reputation: 245
I followed https://github.com/graphaware/neo4j-uuid link to generate UUID for each and every neo4j node which gets created from Spring boot application. Here is the list of steps I followed as per the link:
Added graphaware-uuid-3.3.3.52.16.jar
file to \plugins
folder of Neo4jDB.
In my case C:\Users\Naveen\AppData\Roaming\Neo4j Desktop\Application\neo4jDatabases\database-***\installation-3.3.2\plugins
Added following configurations to \conf\neo4j.conf file
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
Created Model class in spring boot application
@NodeEntity
public class Skill {
@GraphId
private Long graphId;
@Property(name = "uuid")
private Long uuid;
@Property(name = "skillName")
private String skillName;
//...getters and setters
}
Created Spring Neo4j Data repository interface
public interface SkillRepository extends GraphRepository<Skill> {
}
Started Neo4j DB and loaded Spring context and tested the configurations:
public Skill createkill() {
Skill skill = new Skill();
skill.setSkillName("Java");
skill = skillRepository.save(skill);
return skill;
}
Issue: Node is getting created in Neo4j DB with graphId
property populating automatically, but uuid
property is not populated. The returned Skill object is holding null value for uuid
property.
I checked Graphaware Framework and UUID not starting on Neo4j GrapheneDB and GraphAware UUID not generating links but couldn't find any solution for my problem.
Please help out to know what I am doing wrong or if I am missing anything.
Or suggest any alternate uuid
generation solution.
Version details of libraries and tools used:
Java 1.8.0_131
Neo4J 3.3.2 Enterprise
graphaware-uuid-3.3.3.52.16.jar
Spring boot 1.5.10
Upvotes: 1
Views: 530
Reputation: 16375
The UUID property is not returned in node creation, but only in the next transaction.
You can check it creating a node using your Java application and querying by this node in Neo4j browser (or starting another transaction and querying in Java application). The UUID property should be present.
Upvotes: 1
Reputation: 245
As mentioned by @Bruno Peres
, All Configurations and code were correct, except
I missed copying GraphAware Server
, Runtime jars
, and its dependent jars in the \plugins
folder. Here is the list of jars which I placed in the \plugins
folder to successfully start Neo4j DB with GraphAware and to generate UUID's.
algorithms-3.0.4.43.5.jar
changefeed-2.3.2.37.7.jar
common-3.3.3.52.jar
graphaware-uuid-3.3.3.52.16.jar
kryo-2.24.0.jar
minlog-1.2.jar
nlp-3.3.2.52.6.jar
objenesis-2.6.jar
runtime-3.3.3.52.jar
runtime-api-3.3.3.52.jar
server-3.3.3.52.jar
server-common-2.2.6.35.jar
spring-beans-4.3.14.RELEASE.jar
spring-context-4.3.14.RELEASE.jar
spring-context-support-4.3.13.RELEASE.jar
spring-core-4.3.14.RELEASE.jar
spring-expression-4.3.14.RELEASE.jar
timetree-3.3.3.52.27.jar
tx-api-3.3.3.52.jar
tx-executor-3.3.3.52.jar
uuid-3.2.jar
writer-3.3.3.52.jar
writer-api-3.3.3.52.jar
GraphAware internally using spring framework. That's why I had include spring jars as well in the folder.
Upvotes: 1