Package com.orientechnologies.orient.core.record.impl

Examples of com.orientechnologies.orient.core.record.impl.ODocument.save()


    // Update docA in db2
    database2.begin(TXTYPE.OPTIMISTIC);
    ODocument vDocA_db2 = database2.load(vDocA_Rid);
    vDocA_db2.field(NAME, "docA_v2");
    vDocA_db2.save();
    database2.commit();

    // Later... read docA with db1.
    database1.begin(TXTYPE.OPTIMISTIC);
    ODocument vDocA_db1_later = database1.load(vDocA_Rid, null, true);
View Full Code Here


    customReferences.put("second", new ODocument("name", "Jay", "surname", "Miner"));

    ODocument doc = new ODocument(database, "Profile");
    doc.field("customReferences", customReferences, OType.EMBEDDEDMAP);

    doc.save();

    List<ODocument> resultset = database.query(new OSQLSynchQuery<ODocument>(
        "select from Profile where customReferences.keys() CONTAINS 'first'"));

    Assert.assertEquals(resultset.size(), 1);
View Full Code Here

    database = ODatabaseDocumentPool.global().acquire(url, "admin", "admin");

    ODocument vDoc = database.newInstance();
    vDoc.setClassName("Profile");
    vDoc.field("nick", "JayM1").field("name", "Jay").field("surname", "Miner");
    vDoc.save();

    vDoc = database.load(vDoc.getIdentity());
    vDoc.field("nick", "JayM2");
    vDoc.field("nick", "JayM3");
    vDoc.save();
View Full Code Here

    vDoc.save();

    vDoc = database.load(vDoc.getIdentity());
    vDoc.field("nick", "JayM2");
    vDoc.field("nick", "JayM3");
    vDoc.save();

    OPropertyIndex index = database.getMetadata().getSchema().getClass("Profile").getProperty("nick").getIndex();

    Set<OIdentifiable> vOldName = index.getUnderlying().get("JayM1");
    Set<OIdentifiable> vIntermediateName = index.getUnderlying().get("JayM2");
View Full Code Here

    database = ODatabaseDocumentPool.global().acquire(url, "admin", "admin");

    ODocument vDoc = database.newInstance();
    vDoc.setClassName("Profile");
    vDoc.field("nick", "Jacky").field("name", "Jack").field("surname", "Tramiel");
    vDoc.save();

    // add a new record with the same name "nameA".
    vDoc = database.newInstance();
    vDoc.setClassName("Profile");
    vDoc.field("nick", "Jack").field("name", "Jack").field("surname", "Bauer");
View Full Code Here

    // add a new record with the same name "nameA".
    vDoc = database.newInstance();
    vDoc.setClassName("Profile");
    vDoc.field("nick", "Jack").field("name", "Jack").field("surname", "Bauer");
    vDoc.save();

    OPropertyIndex indexName = database.getMetadata().getSchema().getClass("Profile").getProperty("name").getIndex();

    // We must get 2 records for "nameA".
    Set<OIdentifiable> vName1 = indexName.getUnderlying().get("Jack");
View Full Code Here

    ODocument vDoc = database.newInstance();
    vDoc.setClassName("Profile");
    vDoc.field("nick", "MostFamousJack").field("name", "Kiefer").field("surname", "Sutherland")
        .field("tag_list", new String[] { "actor", "myth" });
    vDoc.save();

    List<ODocument> result = database.command(
        new OSQLSynchQuery<ODocument>("select from Profile where name = 'Kiefer' and tag_list.size() > 0 ")).execute();

    Assert.assertEquals(result.size(), 1);
View Full Code Here

    Set<String> tags = new HashSet<String>();
    tags.add("test");
    tags.add("yeah");

    vDoc.field("nick", "Dexter").field("name", "Michael").field("surname", "Hall").field("tag_list", tags);
    vDoc.save();

    List<ODocument> result = database.command(new OSQLSynchQuery<ODocument>("select from Profile where name = 'Michael'"))
        .execute();

    Assert.assertEquals(result.size(), 1);
View Full Code Here

        .execute();

    Assert.assertEquals(result.size(), 1);
    ODocument dexter = result.get(0);
    ((Collection<String>) dexter.field("tag_list")).add("actor");
    dexter.save();

    result = database.command(new OSQLSynchQuery<ODocument>("select from Profile where tag_list in 'actor' and tag_list in 'test'"))
        .execute();
    Assert.assertEquals(result.size(), 1);
View Full Code Here

    map1.put("map2", (HashMap<?, ?>) map2);

    final Map<String, HashMap<?, ?>> map3 = new HashMap<String, HashMap<?, ?>>();
    map2.put("map3", (HashMap<?, ?>) map3);

    final ORecordId rid = (ORecordId) newDoc.save().getIdentity();

    final ODocument loadedDoc = database.load(rid);

    Assert.assertTrue(newDoc.hasSameContentOf(loadedDoc));
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.