Package com.orientechnologies.orient.core.metadata.schema

Examples of com.orientechnologies.orient.core.metadata.schema.OSchema.createClass()


  @Test(dependsOnMethods = "testTransactionOptimisticCacheMgmt2Db")
  public void testTransactionMultipleRecords() throws IOException {
    final OSchema schema = database.getMetadata().getSchema();

    if (!schema.existsClass("Account"))
      schema.createClass("Account");

    long totalAccounts = database.countClusterElements("Account");

    String json = "{ \"@class\": \"Account\", \"type\": \"Residence\", \"street\": \"Piazza di Spagna\"}";
View Full Code Here


  @SuppressWarnings("unchecked")
  public void createGraphInTx() {
    final OSchema schema = database.getMetadata().getSchema();

    if (!schema.existsClass("Profile"))
      schema.createClass("Profile");

    database.begin();

    ODocument kim = new ODocument("Profile").field("name", "Kim").field("surname", "Bauer");
    ODocument teri = new ODocument("Profile").field("name", "Teri").field("surname", "Bauer");
View Full Code Here

      }
    };

    final OSchema schema = database.getMetadata().getSchema();
    if (!schema.existsClass("NestedTxClass"))
      schema.createClass("NestedTxClass");

    database.begin();

    final ODocument externalDocOne = new ODocument("NestedTxClass");
    externalDocOne.field("v", "val1");
View Full Code Here

      }
    };

    final OSchema schema = database.getMetadata().getSchema();
    if (!schema.existsClass("NestedTxRollbackOne"))
      schema.createClass("NestedTxRollbackOne");

    ODocument brokenDocOne = new ODocument("NestedTxRollbackOne");
    brokenDocOne.save();

    brokenDocOne = database.load(brokenDocOne.getIdentity(), "*:-1", true);
View Full Code Here

  }

  public void testNestedTxRollbackTwo() {
    final OSchema schema = database.getMetadata().getSchema();
    if (!schema.existsClass("NestedTxRollbackTwo"))
      schema.createClass("NestedTxRollbackTwo");

    database.begin();
    try {
      final ODocument externalDocOne = new ODocument("NestedTxRollbackTwo");
      externalDocOne.field("v", "val1");
View Full Code Here

  public void indexAfterRebuildShouldIncludeAllClusters() {
    // given
    OSchema schema = database.getMetadata().getSchema();
    String className = "IndexClusterTest";

    OClass oclass = schema.createClass(className);
    oclass.createProperty("key", OType.STRING);
    oclass.createProperty("value", OType.INTEGER);
    oclass.createIndex(className + "index1", OClass.INDEX_TYPE.NOTUNIQUE, "key");

    database.newInstance(className).field("key", "a").field("value", 1).save();
View Full Code Here

  private void createSchema(ODatabaseDocumentTx databaseDocumentTx) {
    ODatabaseRecordThreadLocal.INSTANCE.set(databaseDocumentTx);

    OSchema schema = databaseDocumentTx.getMetadata().getSchema();
    OClass testOneClass = schema.createClass("TestOne");

    testOneClass.createProperty("intProp", OType.INTEGER);
    testOneClass.createProperty("stringProp", OType.STRING);
    testOneClass.createProperty("stringSet", OType.EMBEDDEDSET, OType.STRING);
    testOneClass.createProperty("linkMap", OType.LINKMAP, OType.STRING);
View Full Code Here

    testOneClass.createProperty("intProp", OType.INTEGER);
    testOneClass.createProperty("stringProp", OType.STRING);
    testOneClass.createProperty("stringSet", OType.EMBEDDEDSET, OType.STRING);
    testOneClass.createProperty("linkMap", OType.LINKMAP, OType.STRING);

    OClass testTwoClass = schema.createClass("TestTwo");

    testTwoClass.createProperty("stringList", OType.EMBEDDEDLIST, OType.STRING);
  }

  public class DataPropagationTask implements Callable<Void> {
View Full Code Here

public class MathTest {
  public static final void main(String[] args) {
    final ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:test").create();
    final OSchema schema = db.getMetadata().getSchema();
    final OClass clazz = schema.createClass("test");
    clazz.createProperty("numericAtt", OType.DOUBLE);

    db.command(new OCommandSQL("INSERT INTO test(numericAtt) VALUES (28.23)")).execute();

    final List<ODocument> docs = db.query(new OSQLSynchQuery("SELECT FROM test"));
View Full Code Here

      database.drop();
    }

    database.create();
    OSchema schema = database.getMetadata().getSchema();
    schema.createClass("Account");

    record = database.newInstance();

    database.declareIntent(new OIntentMassiveInsert());
    database.begin(TXTYPE.NOTX);
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.