Announcement Announcement Module
Collapse
No announcement yet.
How to get UUID's from Spring data neo4j? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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, 08:47 AM.

  • #2
    Chris,

    From http://en.wikipedia.org/wiki/Univers...ue_identifier:
    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.

    Regards,

    Lasse

    Comment

    Working...
    X