Duplicate id when working with multiple Spring JVM's


(Thomas Rotte) #1

Hello;

We are working with 2 different JVM's that are creating elements on our Database;
Next to that, we have an offline system that uses objects from the database, to add relationships. The actual update is done in one of the two JVMs

We end up with some objects that look a mixture of two objects. They have one Id, but aspects of two different objects (different object classes) in our system.

example:

JVM1:
save Person => id becomes 1

JVM2:
lookup Person(1) and pass it to a offline system

Offline system: add relationship: Person(1) --> Adress

JVM2:
store new Adress:
lookup Person with id(1); add relationship to Adress.

(in the mean time, Person(1) can be deleted, other objects can be created)

Ending up with some objects (one ID) that have type Person and type Adress, and properties of both

Can anybody help.

Thanks in advance

Thomas


(Michael Simons) #2

Could you please describe a bit more of your setup? i.e. are your running the database in server mode, that is: In a 3rd JVM? Or have you by chance 2 embedded databases?
Also: Which strategy do you use in your OGM model to generate ids? If you don't explicitly chose a strategy, than Neo4j-OGM uses ids from the database which are unique, but which can be reused when one node is deleted.

If you pass nodes around different systems, it maybe is a good idea to use some kind of business id or a UUID that is guaranteed to be unique and only used once.