163 words

getObjectId(pc) - JDO StateInterrogation's method

Object getObjectId(
  Object pc

Return a copy of the JDO identity associated with the parameter instance.

Persistent instances of PersistenceCapable classes have a JDO identity managed by the PersistenceManager. This method returns a copy of the ObjectId that represents the JDO identity.

Instances unknown by the implementation return null.

The ObjectId may be serialized and later restored, and used with a PersistenceManager from the same JDO implementation to locate a persistent instance with the same data store identity.

If the JDO identity is managed by the application, then the ObjectId may be used with a PersistenceManager from any JDO implementation that supports the PersistenceCapable class.

If the JDO identity is not managed by the application or the data store, then the ObjectId returned is only valid within the current transaction.

pc - the instance.
a copy of the ObjectId of the parameter instance as of the beginning of the transaction.
JDO 2.0
See Also:
PersistenceManager.getObjectId(Object pc)
PersistenceManager.getObjectById(Object oid, boolean validate)

This documentation page is derived (with some adjustments) from the JDO 2.2 API
and is available under the terms of the Apache License, v. 2.0.