use temporary Record ID during transaction

109 Views Asked by At

I have record A in database.

In a transaction I want to do the following :

  • Create a record B
  • link parent property of A to B : A.parent = B.@rid

Problem is, during a transaction, I get a temporary negative record id. So @rid has a negative position id. How can I use it to set the link in the same transaction ?

Thank you

1

There are 1 best solutions below

2
ldacrema On

The negative RID means that is temporary. When the transaction is committed a real RID will be assigned, after the commit the RID is changed and it's updated in the object.

Here the doc at the end of the page you can see how transactions works