Skip to content

Temporary ID in different transactions #154

@To-om

Description

@To-om

When a create a vertex, I get a temporary ID (ends with ":-2"). I can retrieve that vertex
with the string representation of the ID only in the same transaction.
If I open a new transaction, the ID is unusable

OrientGraph graph1 = factory.getTx();
Vertex v = graph1.addVertex(labelVertex);
String vid = v.id().toString();
Assert.assertEquals(1, graph1.V(vid).toList().size()); // succeeds
graph1.tx().commit();

OrientGraph graph2 = factory.getTx();
Assert.assertEquals(1, graph2.V(vid).toList().size()); // fails

String newId = vid.substring(0, vid.length() - 2) + "0";
Assert.assertEquals(1, graph2.V(vid).toList().size()); // succeeds
graph2.tx().commit();

I suppose replacing ":-2" by ":0" is not the solution.
How can I provide a stable ID to client (I am in a web application context) ?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions