Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-26-2019 08:47 AM
What is the difference between randomUUID and GraphAware UUID ? which one should i use to generate UUID ?
09-26-2019 09:49 AM
https://neo4j.com/docs/cypher-manual/3.5/functions/scalar/#functions-randomuuid is a shortuct of implementation https://docs.oracle.com/javase/8/docs/api/java/util/UUID.html#randomUUID--
i'm not familiar with the innerworkings of GraphAware's implementation
09-26-2019 10:26 AM
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
09-26-2019 10:34 AM
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.
09-26-2019 09:51 AM
GraphAware's implementation is the same.
09-26-2019 02:15 PM
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.
All the sessions of the conference are now available online