PersistenceManagerFactory
- Super Interfaces:
Serializable
PersistenceManagerFactory
is the interface to use to obtain PersistenceManager
instances. All PersistenceManager
instances obtained from the same PersistenceManagerFactory
will have the same default properties. PersistenceManagerFactory
instances may be configured and serialized for later use. They may be stored via JNDI and looked up and used later. Any properties configured will be saved and restored.
Once the first PersistenceManager
is obtained from the PersistenceManagerFactory
, the factory can no longer be configured.
If the ConnectionFactory
property is set (non-null
) then all other Connection properties including ConnectionFactoryName
are ignored; otherwise, if ConnectionFactoryName
is set (non-null
) then all other Connection properties are ignored. Similarly, if the ConnectionFactory2
property is set (non-null
) then ConnectionFactory2Name
is ignored.
Operational state (PersistenceManager
pooling, connection pooling, operational parameters) must not be serialized.
- Since:
- JDO 1.0
Public Methods
FetchGroup
s are made unmodifiable before being added. FetchGroup
s that match existing FetchGroup
s replace the corresponding FetchGroup
s. The replaced FetchGroup
s become unscoped. Match is based on identical class and equal name. The methods addFetchGroups, removeFetchGroups, getFetchGroups, and removeAllFetchGroups are internally serialized. - Parameters:
groups
- an array of FetchGroups
- Throws:
- SecurityExceptionif the caller is not authorized for {@link JDOPermission} ("manageMetadata")
- Since:
- JDO 2.2
addInstanceLifecycleListener
and removeInstanceLifecycleListener
methods are considered to be configuration methods and can only be called when the PersistenceManagerFactory is configurable (before the first time getPersistenceManager is called). The classes
parameter identifies all of the classes of interest. If the classes
parameter is specified as null
, events for all persistent classes and interfaces will be sent to the listener.
The listener will be called for each event for which it implements the corresponding InstanceLifecycleListener interface.
- Parameters:
listener
- the lifecycle listenerclasses
- the classes of interest to the listener
- Since:
- JDO 2.0
If the authorization check succeeds, check to see that all PersistenceManager instances obtained from this PersistenceManagerFactory have no active transactions. If any PersistenceManager instances have an active transaction, throw a JDOUserException, with one nested JDOUserException for each PersistenceManager with an active Transaction.
If there are no active transactions, then close all PersistenceManager instances obtained from this PersistenceManagerFactory, mark this PersistenceManagerFactory as closed, disallow getPersistenceManager methods, and allow all other get methods. If a set method or getPersistenceManager method is called after close, then JDOUserException is thrown.
- Since:
- JDO 1.0
- Return:
- the driver name for the data store connection.
- Since:
- JDO 1.0
- Return:
- the data store connection factory.
- Since:
- JDO 1.0
- Return:
- the data store connection factory.
- Since:
- JDO 1.0
- Return:
- the name of the data store connection factory.
- Since:
- JDO 1.0
- Return:
- the name of the data store connection factory.
- Since:
- JDO 1.0
- Return:
- the URL for the data store connection.
- Since:
- JDO 1.0
- Return:
- the user name for the data store connection.
- Since:
- JDO 1.0
null
. - Return:
- the DataStoreCache
- Since:
- JDO 2.0
FetchGroup
already exists in PersistenceManagerFactory
scope, copy its definition to a new FetchGroup
. If the FetchGroup
does not already exist, create it with no members. The FetchGroup
does not become in scope until it is added to the current set via addFetchGroups. - Parameters:
cls
- the class or interface for the FetchGroupname
- the name of the fetch group
- Return:
- the FetchGroup
- Throws:
- JDOUserException - if the class is not a persistence-capable class or interface
- Since:
- JDO 2.2
- Return:
- a copy of all currently active fetch groups
- Throws:
- SecurityExceptionif the caller is not authorized for {@link JDOPermission} ("getMetadata")
- Since:
- JDO 2.2
- Return:
- the default IngoreCache setting.
- Since:
- JDO 1.0
- Return:
- the Mapping setting.
- Since:
- JDO 1.0
- Return:
- the default Multithreaded setting.
- Since:
- JDO 1.0
- Return:
- the name of this PMF
- Since:
- JDO 2.1
- Return:
- the default NontransactionalRead setting.
- Since:
- JDO 1.0
- Return:
- the default NontransactionalWrite setting.
- Since:
- JDO 1.0
- Return:
- the default Optimistic setting.
- Since:
- JDO 1.0
After the first use of getPersistenceManager
, no "set" methods will succeed.
- Return:
- a
PersistenceManager
instance with default options.
- Since:
- JDO 1.0
userid
and password
are used when obtaining datastore connections from the connection pool. After the first use of getPersistenceManager
, no "set" methods will succeed.
- Parameters:
userid
- the userid for the connectionpassword
- the password for the connection
- Return:
- a
PersistenceManager
instance with default options.
- Since:
- JDO 1.0
When used with a PersistenceManagerFactory
that uses TransactionType JTA, the proxy can be used in a server to dynamically bind to an instance from this factory associated with the thread's current transaction. In this case, the close method is ignored, as the PersistenceManager
is automatically closed when the transaction completes.
When used with a PersistenceManagerFactory
that uses TransactionType RESOURCE_LOCAL, the proxy uses an inheritable ThreadLocal to bind to an instance of PersistenceManager
associated with the thread. In this case, the close method executed on the proxy closes the PersistenceManager
and then clears the ThreadLocal. Use of this method does not affect the configurability of the PersistenceManagerFactory
.
- Return:
- a
PersistenceManager
proxy.
- Since:
- JDO 2.1
VendorName
and VersionNumber
are required. Other keys are optional. - Return:
- the non-configurable properties of this
PersistenceManagerFactory
.
- Since:
- JDO 1.0
- Return:
- the readOnly setting.
- See Also:
setReadOnly
- Since:
- JDO 2.2
- Return:
- the value of the restoreValues property
- Since:
- JDO 1.0
- Return:
- the default RetainValues setting.
- Since:
- JDO 1.0
- Return:
- the TimeZone of the server
- See Also:
setServerTimeZoneID
- Since:
- JDO 2.1
FetchGroup
s become unscoped. The methods addFetchGroups, removeFetchGroups, getFetchGroups, and removeAllFetchGroups are internally serialized. - Throws:
- SecurityExceptionif the caller is not authorized for {@link JDOPermission} ("manageMetadata")
- Since:
- JDO 2.2
FetchGroup
s that match parameter FetchGroup
s are removed. Parameter FetchGroup
s that do not match any existing FetchGroup
are ignored. Removed FetchGroup
s become unscoped. Match is based on identical class and equal name. The methods addFetchGroups, removeFetchGroups, getFetchGroups, and removeAllFetchGroups are internally serialized. - Parameters:
groups
- an array of FetchGroups
- Throws:
- SecurityExceptionif the caller is not authorized for {@link JDOPermission} ("manageMetadata")
- Since:
- JDO 2.2
addInstanceLifecycleListener
and removeInstanceLifecycleListener
methods are considered to be configuration methods and can only be called when the PersistenceManagerFactory is configurable (before the first time getPersistenceManager is called). - Parameters:
listener
- the listener instance to be removed
- Since:
- JDO 2.0
- Parameters:
driverName
- the driver name for the data store connection.
- Since:
- JDO 1.0
- Parameters:
connectionFactory
- the data store connection factory.
- Since:
- JDO 1.0
- Parameters:
connectionFactory
- the data store connection factory.
- Since:
- JDO 1.0
- Parameters:
connectionFactoryName
- the name of the data store connection factory.
- Since:
- JDO 1.0
- Parameters:
connectionFactoryName
- the name of the data store connection factory.
- Since:
- JDO 1.0
- Parameters:
password
- the password for the data store connection.
- Since:
- JDO 1.0
- Parameters:
url
- the URL for the data store connection.
- Since:
- JDO 1.0
- Parameters:
userName
- the user name for the data store connection.
- Since:
- JDO 1.0
CopyOnAttach set to true
specifies that during makePersistent, copies are made of detached parameter instances. With this flag set to false
, detached parameter instances are attached directly and change their state from detached-clean to persistent-clean or from detached-dirty to persistent-dirty.
- See Also:
getCopyOnAttach()
- Since:
- JDO 2.1
- Parameters:
flag
- the default IgnoreCache setting.
- Since:
- JDO 1.0
- Parameters:
mapping
- the Mapping setting.
- Since:
- JDO 1.0
- Parameters:
flag
- the default Multithreaded setting.
- Since:
- JDO 1.0
- Parameters:
name
- the name of this PMF
- Since:
- JDO 2.1
- Parameters:
flag
- the default NontransactionalRead setting.
- Since:
- JDO 1.0
- Parameters:
flag
- the default NontransactionalWrite setting.
- Since:
- JDO 1.0
- Parameters:
flag
- the default Optimistic setting.
- Since:
- JDO 1.0
- Parameters:
name
- the PersistenceUnitName
- See Also:
getPersistenceUnitName()
- Since:
- JDO 2.1
ReadOnly set to false
specifies that no updates can be performed to the datastore, and if updates are attempted a JDOReadOnlyException is thrown.
- See Also:
getReadOnly()
- Since:
- JDO 2.2
true
, at rollback, fields of newly persistent instances are restored to their values as of the beginning of the transaction, and the instances revert to transient. Additionally, fields of modified instances of primitive types and immutable reference types are restored to their values as of the beginning of the transaction. If false
, at rollback, the values of fields of newly persistent instances are unchanged and the instances revert to transient. Additionally, dirty instances transition to hollow. If an implementation does not support this option, a JDOUnsupportedOptionException
is thrown.
- Parameters:
restoreValues
- the value of the restoreValues property
- Since:
- JDO 1.0
- Parameters:
flag
- the default RetainValues setting.
- Since:
- JDO 1.0
- Parameters:
timezoneid
- the TimeZone ID of the server
- Throws:
- JDOUserException - if the parameter does not match an ID from TimeZone.getAvailableIDs()
- See Also:
getServerTimeZoneID()
java.util.TimeZone
java.util.TimeZone()
PersistenceManager.getServerDate()
- Since:
- JDO 2.1
- read-uncommitted
- read-committed
- repeatable-read
- snapshot
- serializable
- Parameters:
level
- the transaction isolation level
- See Also:
getTransactionIsolationLevel()
Constants.TX_READ_UNCOMMITTED
Constants.TX_READ_COMMITTED
Constants.TX_REPEATABLE_READ
Constants.TX_SNAPSHOT
Constants.TX_SERIALIZABLE
- Since:
- JDO 2.2
- Parameters:
name
- the TransactionType
- Throws:
- JDOUserException - if the parameter is not a permitted value
- Since:
- JDO 2.1
Each supported JDO feature is represented by a String
with one of the following values:
javax.jdo.option.TransientTransactional
javax.jdo.option.NontransactionalRead
javax.jdo.option.NontransactionalWrite
javax.jdo.option.RetainValues
javax.jdo.option.Optimistic
javax.jdo.option.ApplicationIdentity
javax.jdo.option.DatastoreIdentity
javax.jdo.option.NonDurableIdentity
javax.jdo.option.ArrayList
javax.jdo.option.HashMap
javax.jdo.option.Hashtable
javax.jdo.option.LinkedList
javax.jdo.option.TreeMap
javax.jdo.option.TreeSet
javax.jdo.option.Vector
javax.jdo.option.Map
javax.jdo.option.List
javax.jdo.option.Array
javax.jdo.option.NullCollection
javax.jdo.option.ChangeApplicationIdentity
javax.jdo.option.BinaryCompatibility
javax.jdo.option.GetDataStoreConnection
javax.jdo.option.UnconstrainedQueryVariables
javax.jdo.option.TransactionIsolationLevel.read-uncommitted
javax.jdo.option.TransactionIsolationLevel.read-committed
javax.jdo.option.TransactionIsolationLevel.repeatable-read
javax.jdo.option.TransactionIsolationLevel.snapshot
javax.jdo.option.TransactionIsolationLevel.serializable
javax.jdo.query.SQL
javax.jdo.query.JDOQL
The standard JDO query language is represented by a String
:
javax.jdo.query.JDOQL
- Return:
- the
Collection
ofString
s representing the supported options.
- Since:
- JDO 1.0