Package com.orientechnologies.orient.core.db.document

Examples of com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.save()


      dbTx = new ODatabaseDocumentTx("remote:localhost/test");
      dbTx.open("admin", "admin");
      ODocument document = new ODocument();
      document.field("name", "something");
      document.field("surname", "something-else");
      document = dbTx.save(document);
      dbTx.commit();
      ODocument doc = dbTx.load(document.getIdentity());
      assertEquals(doc.fields(), document.fields());
      assertEquals(doc.field("name"), document.field("name"));
      assertEquals(doc.field("surname"), document.field("surname"));
View Full Code Here


      dbTx = new ODatabaseDocumentTx("remote:localhost/test");
      dbTx.open("admin", "admin");
      ODocument document = new ODocument();
      document.field("name", "something");
      document.field("surname", "something-else");
      document = dbTx.save(document);
      dbTx.commit();
      ODocument doc = dbTx.load(document.getIdentity());
      assertEquals(doc.fields(), document.fields());
      assertEquals(doc.field("name"), document.field("name"));
      assertEquals(doc.field("surname"), document.field("surname"));
View Full Code Here

    database.create();

    propertyIndexByKey = new OPropertyMapIndexDefinition("tesClass", "fOne", OType.STRING, OPropertyMapIndexDefinition.INDEX_BY.KEY);

    final ODocument docToStore = propertyIndexByKey.toStream();
    database.save(docToStore);

    final ODocument docToLoad = database.load(docToStore.getIdentity());

    final OPropertyIndexDefinition result = new OPropertyMapIndexDefinition();
    result.fromStream(docToLoad);
View Full Code Here

    propertyIndexByValue = new OPropertyMapIndexDefinition("tesClass", "fOne", OType.INTEGER,
        OPropertyMapIndexDefinition.INDEX_BY.VALUE);

    final ODocument docToStore = propertyIndexByValue.toStream();
    database.save(docToStore);

    final ODocument docToLoad = database.load(docToStore.getIdentity());

    final OPropertyIndexDefinition result = new OPropertyMapIndexDefinition();
    result.fromStream(docToLoad);
View Full Code Here

  @Test
  public void testExceptionNotOpenMemory() {

    ODatabaseDocument db = new ODatabaseDocumentTx("memory:test");
    try {
      db.save(new ODocument());
      Assert.fail();
    } catch (ODatabaseException ex) {
    }
    try {
      db.delete(new ODocument());
View Full Code Here

  @Test
  public void testExceptionNotOpenRemote() {

    ODatabaseDocument db = new ODatabaseDocumentTx("remote:127.0.0.1:00");
    try {
      db.save(new ODocument());
      Assert.fail();
    } catch (ODatabaseException ex) {
    }
    try {
      db.delete(new ODocument());
View Full Code Here

  @Test
  public void testExceptionNotOpenPlocal() {

    ODatabaseDocument db = new ODatabaseDocumentTx("plocal:./target/databaseCheck");
    try {
      db.save(new ODocument());
      Assert.fail();
    } catch (ODatabaseException ex) {
    }
    try {
      db.delete(new ODocument());
View Full Code Here

    database.create();

    propertyIndex = new OPropertyIndexDefinition("tesClass", "fOne", OType.INTEGER);

    final ODocument docToStore = propertyIndex.toStream();
    database.save(docToStore);

    final ODocument docToLoad = database.load(docToStore.getIdentity());

    final OPropertyIndexDefinition result = new OPropertyIndexDefinition();
    result.fromStream(docToLoad);
View Full Code Here

              ODocument dummy = new ODocument("DummyObject");
              dummy.field("name", "name" + j);

              Assert.assertEquals(ODatabaseRecordThreadLocal.INSTANCE.get().getURL(), dbUrl);

              dummy = tx.save(dummy);

              // CAN'T WORK FOR LHPEPS CLUSTERS BECAUSE CLUSTER POSITION CANNOT BE KNOWN
              Assert.assertEquals(dummy.getIdentity().getClusterPosition(), OClusterPositionFactory.INSTANCE.valueOf(j), "RID was "
                  + dummy.getIdentity());
View Full Code Here

    emptyCompositeIndex.addIndex(new OPropertyIndexDefinition("testClass", "fOne", OType.INTEGER));
    emptyCompositeIndex.addIndex(new OPropertyIndexDefinition("testClass", "fTwo", OType.STRING));

    final ODocument docToStore = emptyCompositeIndex.toStream();
    database.save(docToStore);

    final ODocument docToLoad = database.load(docToStore.getIdentity());

    final OCompositeIndexDefinition result = new OCompositeIndexDefinition();
    result.fromStream(docToLoad);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.