add try finally for transaction management in vertex move logic
@@ -227,6 +227,7 @@ public class OVertexDocument extends ODocument implements OVertex {
throw new ORecordNotFoundException(toMove.getIdentity(), "The vertex " + toMove.getIdentity() + " has been deleted");
}
boolean moveTx = !db.getTransaction().isActive();
+ try {
if (moveTx) {
db.begin();
}
@@ -299,8 +300,13 @@ public class OVertexDocument extends ODocument implements OVertex {
if (moveTx) {
db.commit();
}
-
return newIdentity;
+ } catch (RuntimeException ex) {
+ if (moveTx) {
+ db.rollback();
+ }
+ throw ex;
+ }
}
private static void detachRidbags(ORecord oldRecord) {
