JDO defines some features that are optional; JDO-compliant implementations are not required to implement them. Each optional feature is identified by a unique name, which includes a javax.jdo.option prefix. You can call the supportedOptions( ) method, defined in PersistenceManagerFactory, to determine which options an implementation supports; it returns a Collection of Strings that contain an option string. Chapter 7 presents an example using this method. Here we enumerate all the optional features and their names.
The optional features can be grouped into the following categories:
Transaction-related optional features
Each instance managed in a JDO environment must have a unique identifier. The following options are associated with identity:
The first three options represent different kinds of identity. The fourth option indicates whether you can change the value of the fields that represent the application identity of an instance.
Support for each form of identity is optional. However, an implementation must support either datastore or application identity, and may support both. In Chapter 1 we used datastore identity, which is supported by all of the current JDO implementations. Until we cover identity in depth in Chapter 10, all of our examples will use datastore identity.
All JDO implementations support the Collection and Set collection interfaces and the HashSet collection class defined in the java.util package. Other collections are optional in JDO, though current implementations support most of them. The following collection options are associated with a corresponding collection interface or class in the java.util package:
Chapter 4 discusses optional collections in more detail. The Array option indicates whether Java's built-in arrays are supported. The NullCollection option indicates whether you can have a null value for a reference to a collection.
The following options deal with transactions and special handling of instances relative to transactions:
Some implementations allow you to read or modify an instance in memory outside of a transaction; this capability is indicated by the NontransactionalRead and NontransactionalWrite options. Some allow the instances you access during a transaction to be retained and made available after the transaction commits; this capability is determined by the RetainValues option. Chapter 14 covers nontransactional access and retaining of instances after commit. Some implementations let you have instances that are transient yet also support transactional semantics; these are called transient transactional instances, and they are covered in Chapter 13. The Optimistic option indicates whether optimistic transactions are supported; these transactions are covered in Chapter 15.