Hello,
I am performing an update operation on an edge and then attempting to retrieve the updated value. However, after executing the SELECT query, the OrientDB API returns stale data for the edge. The returned record does not reflect the updated attribute value, and the @Version is also outdated.
When I check the same record in OrientDB Studio, the updated values and the correct version are displayed.
Below are the steps to reproduce.
Step 1 : Schema setup
CREATE CLASS VertexA EXTENDS V;
CREATE PROPERTY VertexA.StringTest STRING;
CREATE PROPERTY VertexA.IntTest INTEGER;
CREATE CLASS EdgeB EXTENDS E;
CREATE PROPERTY EdgeB.StringEdgeTest STRING;
CREATE PROPERTY EdgeB.IntegerEdgeTest INTEGER;
INSERT INTO VertexA SET StringTest = 'A', IntTest = 25;
INSERT INTO VertexA SET StringTest = 'B', IntTest = 30;
Step 2 : Create database connection using OPartitionedDatabasePool-
String databaseUrl = "url";
String userName = "username";
String password = "password";
OPartitionedDatabasePool pool = new OPartitionedDatabasePool(databaseUrl, userName, password);
ODatabaseDocument db = pool.acquire();
Step 3 : Create Edge from A to B:
db.activateOnCurrentThread();
db.command("CREATE EDGE EdgeB FROM "
+ "(SELECT FROM VertexA WHERE StringTest = 'A') TO "
+ "(SELECT FROM VertexA WHERE StringTest = 'B') "
+ "SET StringTest = 'A-B', IntTest = 3");
db.commit();
Step 4 : Update Edge A to B:
db.activateOnCurrentThread();
db.command("UPDATE EdgeB SET IntTest = 30 WHERE StringTest = 'A-B'");
db.commit();
Step 5 : Fetch Updated Edge:
db.activateOnCurrentThread();
OResultSet resultSet = db.command("SELECT StringTest, IntTest FROM EdgeB WHERE IntTest = 30");
Why is the Java API returning stale document data after executing the query while OrientDB Studio shows the correct updated version?
What is the recommended way to ensure that the latest version of the document is retrieved?
Thanks
Hello,
I am performing an update operation on an edge and then attempting to retrieve the updated value. However, after executing the SELECT query, the OrientDB API returns stale data for the edge. The returned record does not reflect the updated attribute value, and the @Version is also outdated.
When I check the same record in OrientDB Studio, the updated values and the correct version are displayed.
Below are the steps to reproduce.
Step 1 : Schema setup
Step 2 : Create database connection using OPartitionedDatabasePool-
Step 3 : Create Edge from A to B:
Step 4 : Update Edge A to B:
Step 5 : Fetch Updated Edge:
Why is the Java API returning stale document data after executing the query while OrientDB Studio shows the correct updated version?
What is the recommended way to ensure that the latest version of the document is retrieved?
Thanks