JDO Static Method
in javax.jdo.JDOHelper

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.

Transient instances and instances of classes that do not implement PersistenceCapable 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.

Parameters:
pc - the PersistenceCapable instance.
Return:
a copy of the ObjectId of the parameter instance as of the beginning of the transaction.
See Also:
PersistenceManager.getObjectId(Object pc)
PersistenceCapable.jdoGetObjectId()
PersistenceManager.getObjectById(Object oid,boolean validate)
Since:
JDO 1.0