Chapter 7. PersistenceManagerFactory
Prev | Part 3. Java Data Objects | Next

## Chapter 7. PersistenceManagerFactory

The `PersistenceManagerFactory` creates `PersistenceManager` instances for application use. It allows you to configure datastore connectivity and to specify the default settings of the `PersistenceManager`s 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
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.

Prev | Up | Next
6.3. PersistenceManagerFactory Construction | Home | 7.2. PersistenceManagerFactory Properties