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 |
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.