OnAfterCreate hook retrieves the temporary identity of a document rather than the permanent

#1

I have created server-side hooks to record changes to the DB in an audit_trail table.
The hook is an implementation of ORecordHook.
In the onTrigger method I have the following code:
if (oRecord instanceof ODocument)
{
ODocument doc = (ODocument)oRecord;
String rid = doc.getIdentity().toString();

case AFTER_CREATE: createHook(…, rid, …)
}
The rid I’m getting is the temporary @rid rather than the actual permanent one.

0 Likes

#2

Hi, which version of ODB are you using?

0 Likes

#3

The version of OrientDB is 3.0.12

0 Likes

#4

I have tested it now with all version up to 3.0.18 and the problem is the same:
In onTrigger(), TYPE.AFTER_CREATE, oRecord.getIdentity() returns a negative cluster position.
See issue #8814

0 Likes