Posible error when commiting a new Vertex

I found an error but it’s not clear why or when it happend.
Here is the exception log:

Caused by: com.orientechnologies.orient.core.exception.ORecordNotFoundException: The record with id '#-1:-2' was not found
DB name="tantalo2"
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentAbstract.reload(ODatabaseDocumentAbstract.java:1225)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentAbstract.reload(ODatabaseDocumentAbstract.java:138)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.reload(ODatabaseDocumentTx.java:604)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.reload(ODatabaseDocumentTx.java:66)
at com.orientechnologies.orient.core.record.ORecordAbstract.reload(ORecordAbstract.java:260)
at com.orientechnologies.orient.core.record.ORecordAbstract.reload(ORecordAbstract.java:251)
at com.orientechnologies.orient.core.record.impl.ODocument.reload(ODocument.java:1021)
at com.orientechnologies.orient.core.record.impl.ODocument.reload(ODocument.java:118)
at com.orientechnologies.orient.core.record.ORecordAbstract.checkForLoading(ORecordAbstract.java:510)
at com.orientechnologies.orient.core.record.impl.ODocument.field(ODocument.java:1443)
at com.orientechnologies.orient.core.record.impl.ODocument.field(ODocument.java:1295)
at com.tinkerpop.blueprints.impls.orient.OrientElement.setPropertyInternal(OrientElement.java:640)
at com.tinkerpop.blueprints.impls.orient.OrientElement.setPropertiesInternal(OrientElement.java:691)
at com.tinkerpop.blueprints.impls.orient.OrientElement.setProperties(OrientElement.java:170)
at net.odbogm.proxy.ObjectProxy.doCommit(ObjectProxy.java:687)
at net.odbogm.proxy.ObjectProxy.___commit(ObjectProxy.java:654)
... 58 more

The vertex state is this:

MUY DETALLADO[2019/06/10 07:54:30]:net.odbogm.proxy.ObjectProxy doCommit :: Iniciando ___commit() .... 
MUY DETALLADO[2019/06/10 07:54:30]:net.odbogm.proxy.ObjectProxy doCommit :: valid: true
MUY DETALLADO[2019/06/10 07:54:30]:net.odbogm.proxy.ObjectProxy doCommit :: dirty: true
MUY DETALLADO[2019/06/10 07:54:30]:net.odbogm.proxy.ObjectProxy doCommit :: isNew: true

Following the code I find that it check the load status of the RecordElement, but why do this when the vertex is new?

Here is the log and vertex internal status:

MUY DETALLADO[2019/06/10 10:17:12]:net.odbogm.proxy.ObjectProxy doCommit :: valid: true
MUY DETALLADO[2019/06/10 10:17:12]:net.odbogm.proxy.ObjectProxy doCommit :: dirty: true
MUY DETALLADO[2019/06/10 10:17:12]:net.odbogm.proxy.ObjectProxy doCommit :: isNew: true
MUY DETALLADO[2019/06/10 10:17:12]:net.odbogm.proxy.ObjectProxy doCommit :: New Vertex: Internal Status: NOT_LOADED

I fix this forcing the internal status when the vertex is new to LOADED with this:

if (this.___baseElement.getIdentity().isNew()) {
            LOGGER.log(Level.FINER, "New Vertex: Internal Status: "+this.___baseElement.getRecord().getInternalStatus()); 

and it seems to work. For now, none test fail but I don’t know if this is correct or what’s it implies



Temporary Record ID have Cluster Id -1 and Cluster Position < -1. When a new transaction begun the counter is reset to -1:-2.
At commit time, these temporary records Record IDs will be converted in the final ones.

hope it helps


Hi Michela.

Yes, everything ok with temporary IDs, but the problem is that Orient is trying to reload the vertex from the database, and the vertex not exist because is temporary.

The exception is thrown when I call the setProperties:




did you insert a commit() part in your code?



It happend when the app call to save, so It copy the frontend fields to the vertex (in this point fail) and previous to the commit() call.
But it is working in another, but more simple, screens, and failing in one that is more complex.
I trying to extract the code to reproduce the error but outside the app its work. My be it is related to the Payara environment and HTTP threads.
With the patch over de RecordElement State it is working but its not clear for me if that not affect another part of the DB.

Hi @mdre

are you able to provider a reproducer like a test case or a script ?