LATEST VERSION: 8.2.6 - CHANGELOG
Pivotal GemFire® v8.2

Performing put, get, and localDestroy Operations with a PDX Domain Object

Performing put, get, and localDestroy Operations with a PDX Domain Object

This topic demonstrates how you can perform operations on a PDX domain object after you have implemented PDX serializable in your domain class.

For example, you can perform operations like put, get, and localDestroy with the domain class you defined for PDX serialization in the PdxSerializable Example.

To perform operations, you could write the following application code:

  1. Register the PDX domain class.
    Serializable::registerPdxType(PdxObject::createDeserializable);
  2. Create the PDX domain object PdxObject.
    CacheablePtr pdxobj(new PdxObject(100, "Value-1"));
    CacheableKeyPtr keyport = CacheableKey::create("ABC");
  3. Here's an example of a put operation.
    rptr->put(keyport, pdxobj);
  4. Here's an example of locally destroying the entry.
    rptr->localDestroy(keyport);
  5. Here's an example of a get operation.
    PdxObject *obj2 = dynamic_cast<PdxObject *> ((rptr->get(keyport)).ptr());
      LOGINFO("Debug:Returned ID = %d", obj2->getID());