An ODocument object with a negative RID returns, while saving an ODocument through an OrientDB transaction. This occurs only when transaction presents.
The version of Orientdb: orientdb-community-2.0.3
The negative RID means that is temporary.
When the transaction is committed a real RID will be assigned
Yes, Since it returns a temporary(negative) rid, unable retrieve the actual object with the real rid. Therefore the saved object is unable to identify, just after saving it and if an application required the returned object with the actual RID, it'll impossible with this. Then the application will need to keep another unique id to retrieve the saved object (ODocument).
@randikaf So the temporary ID has been saved in database? Could you please try the most recent hotfix 2.0.10 or also 2.1-rc4?
@lvca No, after the commit is done, it changes to the real RID, but the problem is how do I get that real RID when finish the commit(end of the transaction)?
I used 2.0.10 also.
@randikaf After the commit the RID is changed and it's updated in the object, so you could get that.
Hi, same problem here. I run this simple code in v.2.1rc5
db = orient.getGraph();
var rid = db.command('sql','create vertex v');
db.commit;
return rid;
but the returned rid is still negative. How do I get the real one?
@lvca ,I agree with @Xenophyte, it would be better that it returns the real rid before the transaction is committed so that we can do all the operations inside one transaction .(for instance, create an edge after creating two vertexes, just like the Batch did.