Mateusz, After the commit the object will have a permanent ID assigned to it so if you retrieve the identity of the saved object, you should get a permanent record ID.
Odysseas On Wednesday, March 26, 2014 11:16:43 AM UTC-4, Mateusz Dymczyk wrote: > > As mentioned in the wiki ( > https://github.com/orientechnologies/orientdb/wiki/Transactions) while > storing documents in the DB in a transaction they are assigned a temporary > ID. Is there any way to get the permanent ID of that record after a commit? > I read in one of the discussions that the commit() should return a mapping > of changed IDs but I couldn't find is it how it actually works/how to use > it. > > Let's say we have a sample code like in the wiki example: > > try{ db.begin(TXTYPE.OPTIMISTIC); > ODocument saved = db.save(document); > db.commit(); return saved; > } catch( Exception e ){ db.rollback();} finally{ > db.close();} > > Is there a way to store in "saved" the permanent ID instead of the > temporary one before the return statement? A query for that permanent ID > would be one way but I would really prefer to avoid having to do that kind > of "tricks". > > Regards, > Mateusz > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
