Java Code Examples for com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx#begin()

The following examples show how to use com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx#begin() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LuceneInsertReadMultithreadTest.java    From orientdb-lucene with Apache License 2.0 6 votes vote down vote up
@Override
public void run() {

  db = new ODatabaseDocumentTx(url);
  db.open("admin", "admin");
  db.declareIntent(new OIntentMassiveInsert());
  db.begin();
  for (int i = 0; i < cycle; i++) {
    ODocument doc = new ODocument("City");

    doc.field("name", "Rome");

    db.save(doc);
    if (i % commitBuf == 0) {
      db.commit();
      db.begin();
    }

  }

  db.close();
}
 
Example 2
Source File: LuceneInsertMultithreadTest.java    From orientdb-lucene with Apache License 2.0 6 votes vote down vote up
@Override
public void run() {

  db = new ODatabaseDocumentTx(url);
  db.open("admin", "admin");
  db.declareIntent(new OIntentMassiveInsert());
  db.begin();
  for (int i = 0; i < cycle; i++) {
    ODocument doc = new ODocument("City");

    doc.field("name", "Rome");

    db.save(doc);
    if (i % commitBuf == 0) {
      db.commit();
      db.begin();
    }

  }

  db.close();
}
 
Example 3
Source File: ComponentDatabaseUpgrade_1_5.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example 4
Source File: OOrientDBLoader.java    From orientdb-etl with Apache License 2.0 4 votes vote down vote up
private void beginTransaction(final ODatabaseDocumentTx db) {
  db.begin();
  if (txUseLog != null)
    db.getTransaction().setUsingLog(txUseLog);
}