Chapter 7. PersistenceManagerFactory

7.1. Obtaining a PersistenceManagerFactory
7.2. PersistenceManagerFactory Properties
7.2.1. Connection Configuration
7.2.2. PersistenceManager and Transaction Defaults
7.3. Obtaining PersistenceManagers
7.4. Properties and Supported Options
7.5. DataStoreCache Access
7.6. Closing the PersistenceManagerFactory

The PersistenceManagerFactory creates PersistenceManager instances for application use. It allows you to configure datastore connectivity and to specify the default settings of the PersistenceManagers it constructs. You can also use it to programmatically discover what JDO options your current vendor supports, enabling you to build applications that optimize themselves for full-featured products, but still function under more basic JDO implementations.

[Note]Note

Kodo extends the standard PersistenceManagerFactory with the KodoPersistenceManagerFactory interface to provide additional functionality.

7.1. Obtaining a PersistenceManagerFactory

JDO vendors may supply public constructors for their PersistenceManagerFactory implementations, but the recommended method of obtaining a PersistenceManagerFactory is through the Java Connector Architecture (JCA) in a managed environment, or through the JDOHelper's getPersistenceManagerFactory methods in an unmanaged environment, as described in Section 6.3, “PersistenceManagerFactory Construction”. PersistenceManagerFactories obtained through these means are immutable; any attempt to change their property settings will result in a JDOUserException. This is because the returned factory may come from a pool, and might be shared by other application components.

JDO requires that concrete PersistenceManagerFactory classes implement the Serializable interface. This allows you to create and configure a PersistenceManagerFactory, then serialize it to a file or store it in a Java Naming and Directory Interface (JNDI) tree for later retrieval and use.

 

Skip navigation bar   Back to Top