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

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


    ODatabaseDocumentTx db = new ODatabaseDocumentTx(url);
    db.open("admin", "admin");

    ODocument doc = new ODocument(db, "Account");
    doc.field("version", 0);
    doc.save();

    doc.setDirty();
    doc.setVersion(1);
    try {
      doc.save();
View Full Code Here


    doc.save();

    doc.setDirty();
    doc.setVersion(1);
    try {
      doc.save();
      Assert.assertTrue(false);
    } catch (OConcurrentModificationException e) {
      Assert.assertTrue(true);
    }
View Full Code Here

    tags.add("nice");

    ODocument doc = new ODocument(database, "Profile");
    doc.field("tags", tags);

    doc.save();

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

    Assert.assertEquals(resultset.size(), 1);
    Assert.assertEquals(resultset.get(0).getIdentity(), doc.getIdentity());
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 CONTAINSKEY 'first'"));

    Assert.assertEquals(resultset.size(), 1);
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();

    Collection<OIdentifiable> vOldName = index.getUnderlying().get("JayM1");
    Assert.assertEquals(vOldName.size(), 0);
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".
    Collection<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

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.