You can use application identity with a datastore that allows the values in an instance to determine its identity. The values of one or more persistent fields in the instance form a unique value that is referred to as the primary key ; the fields are referred to as the primary-key fields. The application is responsible for generating the values of the primary-key fields to ensure they collectively have a unique value for each instance in the datastore. The primary-key fields must have a unique value for a given class and its subclasses that use the same application identity class.
You indicate that a Java field is a component of the primary key
in the metadata by setting the
attribute of the field’s associated
field element to "
true“. Each field of the primary key must
have this attribute set to "
it has a default value of "
The primary-key fields of a persistent class must be persistent.
attribute of the
element cannot be set to "
transactional" or "
none“. The primary-key fields become a
property of the persistent class that cannot be changed after the
class is enhanced. If you need to change the set of fields in a
primary key, you will need to enhance the class again. Read access to
primary-key fields is never mediated.
The type of primary-key fields must be serializable and should
be one of the primitive types,