cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

What is the difference between randomUUID and GraphAware UUID?

What is the difference between randomUUID and GraphAware UUID ? which one should i use to generate UUID ?

5 REPLIES 5

Will it generate unique ID everytime when using it in query ? or should i use GraphAware ?, GraphAware need two statements to return UUID, CREATE statement and then MATCH statement (cause it runs on the server). @bob.bierman

If your use case is just to manually generate a UUID from a function, then they should be functionally identical. GraphAware implemented this before we included it in the product, but it's important enough that we added UUID generation in as well.

I believe GraphAware's UUID module covers more than just this, doing automatic assigning of UUIDs to nodes and relationships and extra validation on top of that.

GraphAware's implementation is the same.

We installed the GraphAware uuid generator as a plugin to automatically create distinct uuid's on every node added, and it works well for that (it has configurable options to generate uuid's only on specific node and relationship types, or use your own generator function, and some other options, if desired). In my java code however, I call the java.util function and use that value directly in the uuid property of CREATE statements because (as you note) the GA plugin requires a separate call to retrieve the newly added node's uuid, and this approach negates the need for that call. Note that if you supply the uuid property on a CREATE/MERGE for a new node, then GA will not override that field, it uses what you supply. Note also that you cannot change a uuid property on an existing node (no matter how it was added), GA will throw an exception.

And yes, the generator method creates a universally distinct value on every call, statistically speaking.

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online