JDO Predefined ID Classes

An object ID is a combination of a persistence capable class and a primary key. It provides a unique representation of a persistent object.

The following classes serve as predefined ID classes for persistence capable classes with a simple single field primary key:

Object IDs are used in many PersistenceManager methods (getObjectId, getObjectById, getObjectByIds, etc.) to represent objects but should not be used as the type of a primary key field in a persistence capable class.

For example, to use a String primary key define a primary key field of type String:

@PersistenceCapable
public class MyClass {
    @PrimaryKey String id;
}

Persistent objects with a String primary key (including instances of MyClass) can be represented uniquely by StringIdentity, as a combination of a class and a string value.