Announcement Announcement Module
No announcement yet.
How to get UUID's from Spring data neo4j? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get UUID's from Spring data neo4j?

    I need to get a UUID wich is valid across multiple vm's so my only conclusion was to retrieve a UUID from the neo4j db (or store and handle it there).

    Is there an implementation I can rely on or do I have to implement this myself?

    I did a research on this and only found low level neo4j hints, which stated I need a lock on a node, then get the id, increment it and write it back. But I am having trouble implementing this.

    Any code snippets on how to do this would be greatly appreciated.

    EDIT: I wrote a small hack and created a node that only has a unique id and a method that write locks this node and then increases that id. But a native, thread safe method would be way cooler.
    Last edited by chris_ds; Jul 17th, 2012, 07:47 AM.

  • #2

    The intent of UUIDs is to enable distributed systems to uniquely identify information without significant central coordination
    I don't think you need to worry about this - UUID.randomUUID() works just fine.