168 words

jdoGetObjectId() - JDO PersistenceCapable's method

Method
javax.jdo.spi.PersistenceCapable
Object jdoGetObjectId()

Return a copy of the JDO identity associated with this 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 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.

If the JDO identity is being changed in the transaction, this method returns the object id as of the beginning of the current transaction.

Returns:
a copy of the ObjectId of this instance as of the beginning of the transaction.
Since:
JDO 1.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.