@Override public void begin() { db.begin(); }
@Override @Transitions(from = OPEN, to = ACTIVE) public void begin() { db.begin(TXTYPE.OPTIMISTIC); }
private void beginTransaction(final ODatabaseDocumentTx db) { db.begin(); if (txUseLog != null) db.getTransaction().setUsingLog(txUseLog); }
private boolean populateCaseInsensitiveNameFieldBatch(final ODatabaseDocumentTx db) { log.trace("Processing batch of {} component records...", BATCH_SIZE); db.begin(); List<ODocument> components = db.query(SELECT_COMPONENT_BATCH); if (components.isEmpty()) { return false; } for (ODocument component : components) { String name = component.field(P_NAME, String.class); component.field(P_CI_NAME, name.toLowerCase(Locale.ENGLISH)); component.save(); } db.commit(); return true; }
@Override @Timed public boolean test(final BlobStore blobStore, final BlobId blobId, final String blobName) { BlobRef blobRef = new BlobRef(ANY_NODE, blobStore.getBlobStoreConfiguration().getName(), blobId.asUniqueString()); try (ODatabaseDocumentTx tx = txSupplier.get()) { tx.begin(); List<ODocument> results = tx.command(assetBlobRefQuery).execute(blobName, blobRef.toString()); return !results.isEmpty(); } } }
@Override protected void autoStartTransaction() { super.autoStartTransaction(); if (!autoStartTx) return; final OrientGraphContext context = getContext(true); if (context.rawGraph.getTransaction() instanceof OTransactionNoTx && context.rawGraph.getTransaction().getStatus() != TXSTATUS.BEGUN) { context.rawGraph.begin(); } }
public static <T> T runInTx(final OrientGraph graph, final GraphCallBack<T> callBack) { final ODatabaseDocument databaseRecord = getDatabase(); final boolean txWasActive = databaseRecord.getTransaction().isActive(); if (!txWasActive) graph.getRawGraph().begin(); try { final T result = callBack.call(graph); if (!txWasActive) graph.commit(); return result; } catch (RuntimeException e) { if (!txWasActive) graph.rollback(); throw e; } }