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

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


          ODatabaseHelper.freezeDatabase(database);
          database.open("admin", "admin");

          final List<ODocument> beforeNonTxDocuments = database.query(new OSQLSynchQuery<Object>("select from "
              + STUDENT_CLASS_NAME));
          final List<ODocument> beforeTxDocuments = database.query(new OSQLSynchQuery<Object>("select from " + TRANSACTIONAL_WORD
              + STUDENT_CLASS_NAME));

          database.close();

          System.out.println("Freeze DB - nonTx : " + beforeNonTxDocuments.size() + " Tx : " + beforeTxDocuments.size());
View Full Code Here


          System.out.println("Freeze DB - nonTx : " + beforeNonTxDocuments.size() + " Tx : " + beforeTxDocuments.size());
          try {
            Thread.sleep(10000);
          } finally {
            database.open("admin", "admin");
            final List<ODocument> afterNonTxDocuments = database.query(new OSQLSynchQuery<Object>("select from "
                + STUDENT_CLASS_NAME));
            final List<ODocument> afterTxDocuments = database.query(new OSQLSynchQuery<Object>("select from " + TRANSACTIONAL_WORD
                + STUDENT_CLASS_NAME));
            assertDocumentAreEquals(beforeNonTxDocuments, afterNonTxDocuments);
            assertDocumentAreEquals(beforeTxDocuments, afterTxDocuments);
View Full Code Here

            Thread.sleep(10000);
          } finally {
            database.open("admin", "admin");
            final List<ODocument> afterNonTxDocuments = database.query(new OSQLSynchQuery<Object>("select from "
                + STUDENT_CLASS_NAME));
            final List<ODocument> afterTxDocuments = database.query(new OSQLSynchQuery<Object>("select from " + TRANSACTIONAL_WORD
                + STUDENT_CLASS_NAME));
            assertDocumentAreEquals(beforeNonTxDocuments, afterNonTxDocuments);
            assertDocumentAreEquals(beforeTxDocuments, afterTxDocuments);

            database.close();
View Full Code Here

    testClassDocument.save();
    db.commit();

    // THIS WILL THROW A java.lang.ClassCastException: com.orientechnologies.orient.core.id.ORecordId cannot be cast to
    // java.lang.Boolean
    List<ODocument> result = db.query(new OSQLSynchQuery<ODocument>("select from TestClass where testLink.testBoolean = true"));
    Assert.assertEquals(result.size(), 2);
    // THIS WILL THROW A java.lang.ClassCastException: com.orientechnologies.orient.core.id.ORecordId cannot be cast to
    // java.lang.String
    result = db.query(new OSQLSynchQuery<ODocument>("select from TestClass where testLink.testString = 'Test Link Class 2'"));
    Assert.assertEquals(result.size(), 1);
View Full Code Here

    // java.lang.Boolean
    List<ODocument> result = db.query(new OSQLSynchQuery<ODocument>("select from TestClass where testLink.testBoolean = true"));
    Assert.assertEquals(result.size(), 2);
    // THIS WILL THROW A java.lang.ClassCastException: com.orientechnologies.orient.core.id.ORecordId cannot be cast to
    // java.lang.String
    result = db.query(new OSQLSynchQuery<ODocument>("select from TestClass where testLink.testString = 'Test Link Class 2'"));
    Assert.assertEquals(result.size(), 1);

    db.close();
  }
View Full Code Here

    ODocument docOne = new ODocument("TransactionUniqueIndexTest");
    docOne.field("label", "A");
    docOne.save();

    final List<ODocument> resultBeforeCommit = db.query(new OSQLSynchQuery<ODocument>(
        "select from index:idxTransactionUniqueIndexTest"));
    Assert.assertEquals(resultBeforeCommit.size(), 1);

    db.begin();
    try {
View Full Code Here

    } catch (OResponseProcessingException e) {
      Assert.assertTrue(e.getCause() instanceof ORecordDuplicatedException);
    } catch (ORecordDuplicatedException oie) {
    }

    final List<ODocument> resultAfterCommit = db.query(new OSQLSynchQuery<ODocument>(
        "select from index:idxTransactionUniqueIndexTest"));
    Assert.assertEquals(resultAfterCommit.size(), 1);
  }

  @Test(dependsOnMethods = "testTransactionUniqueIndexTestOne")
View Full Code Here

      termClass.createProperty("label", OType.STRING);
      termClass.createIndex("idxTransactionUniqueIndexTest", INDEX_TYPE.UNIQUE, "label");
      db.getMetadata().getSchema().save();
    }

    final List<ODocument> resultBeforeCommit = db.query(new OSQLSynchQuery<ODocument>(
        "select from index:idxTransactionUniqueIndexTest"));
    Assert.assertEquals(resultBeforeCommit.size(), 1);

    db.begin();
View Full Code Here

    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"));
    Double value = (Double) docs.get(0).field("numericAtt");

    System.out.println(value);

    Assert.assertEquals(new Double(28.23), new Float(28.23).doubleValue());
View Full Code Here

    try {
      db = getProfiledDatabaseInstance(iRequest);

      final OQueryAbstract command = new OSQLSynchQuery<ODocument>(text, limit).setFetchPlan(fetchPlan);
      response = (List<OIdentifiable>) db.query(command);
      fetchPlan = command.getFetchPlan();

      iResponse.writeRecords(response, fetchPlan);

    } finally {
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.