当前位置: 首页>>代码示例>>Java>>正文


Java ODatabaseDocumentTx.commit方法代码示例

本文整理汇总了Java中com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit方法的典型用法代码示例。如果您正苦于以下问题:Java ODatabaseDocumentTx.commit方法的具体用法?Java ODatabaseDocumentTx.commit怎么用?Java ODatabaseDocumentTx.commit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx的用法示例。


在下文中一共展示了ODatabaseDocumentTx.commit方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fix

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
public static void fix(MeshOptions options) {
	File graphDir = new File(options.getStorageOptions().getDirectory(), "storage");
	if (graphDir.exists()) {
		log.info("Checking database {" + graphDir + "}");
		OrientGraphFactory factory = new OrientGraphFactory("plocal:" + graphDir.getAbsolutePath()).setupPool(5, 100);
		try {
			// Enable the patched security class
			factory.setProperty(ODatabase.OPTIONS.SECURITY.toString(), OSecuritySharedPatched.class);
			ODatabaseDocumentTx tx = factory.getDatabase();
			try {
				OClass userClass = tx.getMetadata().getSchema().getClass("OUser");
				if (userClass == null) {
					log.info("OrientDB user credentials not found. Recreating needed roles and users.");
					tx.getMetadata().getSecurity().create();
					tx.commit();
				} else {
					log.info("OrientDB user credentials found. Skipping fix.");
				}
			} finally {
				tx.close();
			}
		} finally {
			factory.close();
		}
	}
}
 
开发者ID:gentics,项目名称:mesh,代码行数:27,代码来源:MissingOrientCredentialFixer.java

示例2: commitBatch

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
private void commitBatch(final ODatabaseDocumentTx db,
                         final List<BlobRef> deletedBlobs,
                         final Set<String> deletedBlobStores)
{
  checkNotNull(db);
  checkNotNull(deletedBlobs);
  checkNotNull(deletedBlobStores);

  db.commit();

  for (BlobRef blobRef : deletedBlobs) {
    deleteBlob(deletedBlobStores, blobRef);
  }

  deletedBlobs.clear();
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:17,代码来源:BucketDeleter.java

示例3: initGraph

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
protected void initGraph(OrientGraph g) {
    final ODatabaseDocumentTx db = g.getRawDatabase();
    boolean txActive = db.getTransaction().isActive();

    if (txActive)
        // COMMIT TX BEFORE ANY SCHEMA CHANGES
        db.commit();

    OSchema schema = db.getMetadata().getSchema();
    if (!schema.existsClass(OClass.VERTEX_CLASS_NAME))
        schema.createClass(OClass.VERTEX_CLASS_NAME).setOverSize(2);
    if (!schema.existsClass(OClass.EDGE_CLASS_NAME))
        schema.createClass(OClass.EDGE_CLASS_NAME);

    if (txActive) {
        // REOPEN IT AGAIN
        db.begin();
    }
}
 
开发者ID:orientechnologies,项目名称:orientdb-gremlin,代码行数:20,代码来源:OrientGraphFactory.java

示例4: populateCaseInsensitiveNameFieldBatch

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
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;
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:16,代码来源:ComponentDatabaseUpgrade_1_5.java

示例5: enterBatchMode

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
@Override
public void enterBatchMode() {
	ODatabaseDocumentTx db = getGraph();
	if (db.getTransaction().isActive()) {
		saveDirty();
		db.commit();
	}

	currentMode = Mode.NO_TX_MODE;
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:11,代码来源:OrientDatabase.java

示例6: testPointTransactionUpdate

import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; //导入方法依赖的package包/类
@Test
public void testPointTransactionUpdate() {

  ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:txPoint");

  try {
    db.create();

    OSchema schema = db.getMetadata().getSchema();
    OClass v = schema.getClass("V");
    OClass oClass = schema.createClass("City");
    oClass.setSuperClass(v);
    oClass.createProperty("location", OType.EMBEDDED, schema.getClass("OPoint"));
    oClass.createProperty("name", OType.STRING);

    db.command(new OCommandSQL("CREATE INDEX City.location ON City(location) SPATIAL ENGINE LUCENE")).execute();

    OIndex idx = db.getMetadata().getIndexManager().getIndex("City.location");
    ODocument rome = newCity("Rome", 12.5, 41.9);

    db.begin();

    db.save(rome);

    db.commit();

    String query = "select * from City where location && 'LINESTRING(-160.06393432617188 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594 21.787556698550834)' ";
    List<ODocument> docs = db.query(new OSQLSynchQuery<ODocument>(query));
    Assert.assertEquals(0, docs.size());
    Assert.assertEquals(1, idx.getSize());

    db.begin();

    db.command(new OCommandSQL("update City set location = ST_GeomFromText('" + PWKT + "')")).execute();

    query = "select * from City where location && 'LINESTRING(-160.06393432617188 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594 21.787556698550834)' ";
    docs = db.query(new OSQLSynchQuery<ODocument>(query));
    Assert.assertEquals(1, docs.size());
    Assert.assertEquals(1, idx.getSize());

    db.commit();

    query = "select * from City where location && 'LINESTRING(-160.06393432617188 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594 21.787556698550834)' ";
    docs = db.query(new OSQLSynchQuery<ODocument>(query));
    Assert.assertEquals(1, docs.size());
    Assert.assertEquals(1, idx.getSize());

  } finally {
    db.drop();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:52,代码来源:LuceneTransactionGeoQueryTest.java


注:本文中的com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。