Package com.orientechnologies.orient.core.id

Examples of com.orientechnologies.orient.core.id.ORID


    map.put("Luca", new ODocument().field("name", "Luca"));
    map.put("Marcus", new ODocument().field("name", "Marcus"));
    map.put("Cesare", new ODocument(database, "Account").field("name", "Cesare"));

    database.save(newDoc);
    final ORID rid = newDoc.getIdentity();

    database.close();

    database = ODatabaseDocumentPool.global().acquire(url, "admin", "admin");
View Full Code Here


    vDocA_db1.field(NAME, "docA");
    vDocA_db1.unpin();
    vDocA_db1.save();

    // Keep the IDs.
    ORID vDocA_Rid = vDocA_db1.getIdentity().copy();

    database2.begin(TXTYPE.OPTIMISTIC);
    try {
      // Get docA and update in db2 transaction context
      ODocument vDocA_db2 = database2.load(vDocA_Rid);
View Full Code Here

    ODocument vDocA_db1 = database1.newInstance();
    vDocA_db1.field(NAME, "docA");
    vDocA_db1.save();

    // Keep the IDs.
    ORID vDocA_Rid = vDocA_db1.getIdentity().copy();

    database2.begin(TXTYPE.OPTIMISTIC);
    try {
      // Get docA and update in db2 transaction context
      ODocument vDocA_db2 = database2.load(vDocA_Rid);
View Full Code Here

    vDocA_db1.field(NAME, "docA");
    vDocA_db1.save();
    database1.commit();

    // Keep the ID.
    ORID vDocA_Rid = vDocA_db1.getIdentity().copy();

    // Update docA in db2
    database2.begin(TXTYPE.OPTIMISTIC);
    ODocument vDocA_db2 = database2.load(vDocA_Rid);
    vDocA_db2.field(NAME, "docA_v2");
View Full Code Here

      return (ODocument) iPojo;

    ODocument record = objects2Records.get(System.identityHashCode(iPojo));
    if (record == null) {
      // SEARCH BY RID
      final ORID rid = OObjectSerializerHelper.getObjectID(this, iPojo);
      if (rid != null && rid.isValid()) {
        record = rid2Records.get(rid);
        if (record == null)
          // LOAD IT
          record = underlying.load(rid);
      } else if (iCreateIfNotAvailable) {
View Full Code Here

        OObjectSerializerHelper.setObjectID(iRecord.getIdentity(), iObject);
        OObjectSerializerHelper.setObjectVersion(iRecord.getVersion(), iObject);
      }

      final ORID rid = iRecord.getIdentity();
      if (rid.isValid())
        rid2Records.put(rid, doc);
    }
  }
View Full Code Here

      objects2Records.remove(System.identityHashCode(iObject));

    if (iRecord != null) {
      records2Objects.remove(iRecord);

      final ORID rid = iRecord.getIdentity();
      if (rid.isValid())
        rid2Records.remove(rid);
    }
  }
View Full Code Here

        for (Entry<String, Object> e : map.entrySet()) {
          map.put(e.getKey(), convertParameter(e.getValue()));
        }

      } else if (iParameter != null && !OType.isSimpleType(iParameter)) {
        final ORID rid = getIdentity(iParameter);
        if (rid != null && rid.isValid())
          // REPLACE OBJECT INSTANCE WITH ITS RECORD ID
          return rid;
      }

    return iParameter;
View Full Code Here

    database.getCache().clear();
    List<ODocument> resultset = database.query(new OSQLSynchQuery<ODocument>("select * from Profile"));
    Assert.assertEquals(OProfiler.getInstance().getCounter("Cache.reused"), times);

    ORID linked;
    for (ODocument d : resultset) {
      linked = ((ORID) d.field("location", ORID.class));
      if (linked != null)
        Assert.assertFalse(database.getCache().existsRecord(linked));
    }
View Full Code Here

    Assert.assertTrue(result.iterator().next().toString().equals("#13:54"));

    result = database.command(new OCommandSQL("find references 19:0")).execute();

    Assert.assertTrue(result.size() == 2);
    ORID rid = result.iterator().next();
    Assert.assertTrue(rid.toString().equals("#22:0") || rid.toString().equals("#21:0"));
    rid = result.iterator().next();
    Assert.assertTrue(rid.toString().equals("#22:0") || rid.toString().equals("#21:0"));

    result = database.command(new OCommandSQL("find references 9:0")).execute();
    Assert.assertTrue(result.size() == 0);

    result.clear();
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.id.ORID

Copyright © 2018 www.massapicom. 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.