8.5. JDO Identity Management
Prev | Chapter 8. PersistenceManager | Next

## 8.5. JDO Identity Management

Each `PersistenceManager` is responsible for managing the JDO identities of the persistent objects in its cache. The following methods allow you to interact with the management of JDO identities:

- `getObjectIdClass`: Returns the JDO identity class used for the given persistence-capable class.

- `newObjectIdInstance`: This method is used to re-create JDO identity objects from the string returned by their `toString` method. Given a persistence-capable class and a JDO identity string, the method constructs a JDO identity object. Using the `getObjectById` method described below, this identity object can then be employed to obtain the persistent instance whose identity was used to create the string in the first place.

- `getObjectId`: Returns the JDO identity object for a persistent instance managed by this `PersistenceManager`.

- `getObjectById`: This method returns the persistent instance corresponding to the given JDO identity object. If the instance is already cached, the cached version will be returned. Otherwise, a new instance will be constructed, and may or may not be loaded with data from the data store (some implementations might return a hollow instance).

  If the `validate` parameter of this method is set to `true`, then the JDO implementation will throw an exception if the data store record for the given JDO identity does not exist. Otherwise, some implementations might return a hollow instance for the missing record, and an exception will not be thrown until you attempt to access one of its persistent fields.

Prev | Up | Next
8.4. Persistence-capable Lifecycle Management | Home | 8.6. Extent Factory