public class JDOPersistenceManager extends Object implements javax.jdo.PersistenceManager
Modifier and Type | Field and Description |
---|---|
protected org.datanucleus.ExecutionContext |
ec
Backing ExecutionContext for this PersistenceManager.
|
protected JDOFetchPlan |
fetchPlan
JDO Fetch Plan.
|
protected javax.jdo.Transaction |
jdotx |
static org.datanucleus.util.NucleusLogger |
LOGGER
Logger for JDO.
|
protected JDOPersistenceManagerFactory |
pmf
Owning PersistenceManagerFactory.
|
Constructor and Description |
---|
JDOPersistenceManager(JDOPersistenceManagerFactory pmf,
String userName,
String password)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener,
Class... classes)
Method to register a lifecycle listener as per JDO 2.0 spec 12.15.
|
void |
addTransactionEventListener(org.datanucleus.TransactionEventListener listener)
Convenience method to add a listener for transaction events (begin, commit, rollback).
|
protected void |
assertActiveTransaction()
Method to assert if the current transaction is active.
|
protected void |
assertIsOpen()
Method to assert if this Persistence Manager is open.
|
protected void |
assertReadable(String operation)
Method to assert if no active transaction and nontransactionalRead is not set.
|
protected void |
assertWritable()
Method to assert if the current transaction is active or non transactional writes are allowed.
|
void |
checkConsistency()
This method validates the cache with the datastore.
|
void |
close()
Method to close the Persistence Manager.
|
javax.jdo.Transaction |
currentTransaction()
Accessor for the current transaction.
|
void |
deletePersistent(Object obj)
JDO method to delete an object from the datastore.
|
void |
deletePersistentAll(Collection pcs)
JDO method to delete a collection of objects from the datastore.
|
void |
deletePersistentAll(Object... pcs)
JDO method to delete an array of objects from the datastore.
|
<T> T |
detachCopy(T pc)
JDO method to detach a persistent object.
|
<T> Collection<T> |
detachCopyAll(Collection<T> pcs)
Detach the specified objects from the
PersistenceManager . |
<T> T[] |
detachCopyAll(T... pcs)
Detach the specified objects from the
PersistenceManager . |
void |
evict(Object obj)
Method to evict an object from L1 cache.
|
void |
evictAll()
Method to evict all current objects from L1 cache.
|
void |
evictAll(boolean subclasses,
Class cls)
Method to evict all objects of the specified type (and optionaly its subclasses).
|
void |
evictAll(Collection pcs)
Method to evict a collection of objects from L1 cache.
|
void |
evictAll(Object... pcs)
Method to evict an array of objects from L1 cache.
|
void |
flush()
This method flushes all dirty, new, and deleted instances to the
datastore.
|
boolean |
getCopyOnAttach()
Accessor for whether to copy objects on attaching.
|
javax.jdo.datastore.JDOConnection |
getDataStoreConnection()
Accessor for a connection on the datastore.
|
Integer |
getDatastoreReadTimeoutMillis()
Accessor for the datastore read timeout (milliseconds).
|
Integer |
getDatastoreWriteTimeoutMillis()
Accessor for the datastore write timeout (milliseconds).
|
boolean |
getDetachAllOnCommit()
Accessor for whether to detach all objects on commit of the transaction.
|
org.datanucleus.ExecutionContext |
getExecutionContext()
Convenience accessor for the ExecutionContext performing the actual persistence.
|
<T> javax.jdo.Extent<T> |
getExtent(Class<T> pcClass)
Extents are collections of datastore objects managed by the datastore,
not by explicit user operations on collections.
|
<T> javax.jdo.Extent<T> |
getExtent(Class<T> pcClass,
boolean subclasses)
Extents are collections of datastore objects managed by the datastore,
not by explicit user operations on collections.
|
javax.jdo.FetchGroup |
getFetchGroup(Class cls,
String name)
Method to return a fetch group for the specified class, with the specified name.
|
javax.jdo.FetchPlan |
getFetchPlan()
Acessor for the current FetchPlan
|
boolean |
getIgnoreCache()
Accessor for whether to ignore the cache.
|
Set |
getManagedObjects()
Accessor for the objects currently managed by this PM in the current transaction.
|
Set |
getManagedObjects(Class... classes)
Accessor for the objects currently managed by this PM in the current transaction.
|
Set |
getManagedObjects(EnumSet states)
Accessor for the objects currently managed by this PM in the current transaction.
|
Set |
getManagedObjects(EnumSet states,
Class... classes)
Accessor for the objects currently managed by this PM in the current transaction.
|
boolean |
getMultithreaded()
Accessor for whether the Persistence Manager is multithreaded.
|
<T> T |
getObjectById(Class<T> cls,
Object key)
Method to look up the instance of the given type with the given key.
|
Object |
getObjectById(Object id)
Accessor for an object given the object id.
|
Object |
getObjectById(Object id,
boolean validate)
Accessor for an object given the object id.
|
<T> T |
getObjectByUnique(Class<T> cls,
String[] fieldNames,
Object[] fieldValues)
Method to look up the instance of the given type with the given key.
|
Object |
getObjectId(Object pc)
Accessor for an object id given the object.
|
Class |
getObjectIdClass(Class cls)
Accessor for the class of the object id given the class of object.
|
Object[] |
getObjectsById(boolean validate,
Object... oids)
Accessor for the objects given the object ids.
|
Collection |
getObjectsById(Collection oids)
Accessor for the objects given the object ids, validating the objects.
|
Collection |
getObjectsById(Collection oids,
boolean validate)
Accessor for the objects given the object ids.
|
Object[] |
getObjectsById(Object... oids)
Accessor for the objects given the object ids, validating the objects.
|
JDOPersistenceManagerFactory |
getPersistenceManagerFactory()
Accessor for the PersistenceManager Factory.
|
Map<String,Object> |
getProperties()
Get the properties and associated values currently in effect for the
persistence manager.
|
javax.jdo.datastore.Sequence |
getSequence(String sequenceName)
Method to retrieve a sequence by name.
|
Date |
getServerDate()
Accessor for the date on the datastore.
|
Set<String> |
getSupportedProperties()
Get the names of the properties that are supported for use with the
persistence manager.
|
Object |
getTransactionalObjectId(Object pc)
Accessor for the object id of a transactional object given the object.
|
Object |
getUserObject()
The application might manage PersistenceManager instances by using an
associated object for bookkeeping purposes.
|
Object |
getUserObject(Object key)
Method to get a user object from the PersistenceManager.
|
protected boolean |
hasPersistenceInformationForClass(Class cls)
Utility method to check if the specified class has reachable metadata/annotations.
|
protected void |
internalClose()
The internal method called by the PMF to cleanup this PM.
|
boolean |
isClosed()
Accessor for whether this ExecutionContext is closed.
|
void |
makeNontransactional(Object pc)
Method to make nontransactional an object.
|
void |
makeNontransactionalAll(Collection pcs)
Method to make nontransactional a collection of objects.
|
void |
makeNontransactionalAll(Object... pcs)
Method to make nontransactional an array of objects.
|
<T> T |
makePersistent(T obj)
JDO method to persist an object.
|
<T> Collection<T> |
makePersistentAll(Collection<T> pcs)
JDO method to make persistent a collection of objects.
|
<T> T[] |
makePersistentAll(T... pcs)
JDO method to make persistent an array of objects.
|
void |
makeTransactional(Object pc)
Method to make transactional an object.
|
void |
makeTransactionalAll(Collection pcs)
Method to make transactional a collection of objects.
|
void |
makeTransactionalAll(Object... pcs)
Method to make transactional an array of objects.
|
void |
makeTransient(Object pc)
Method to make transient an object.
|
void |
makeTransient(Object pc,
boolean useFetchPlan)
Method to make transient an object allowing fetching using the fetch plan.
|
void |
makeTransientAll(boolean includeFetchPlan,
Object... pcs)
Method to make transient an array of objects.
|
void |
makeTransientAll(Collection pcs)
Method to make transient a collection of objects.
|
void |
makeTransientAll(Collection pcs,
boolean useFetchPlan)
Method to make transient a collection of objects.
|
void |
makeTransientAll(Object... pcs)
Method to make transient an array of objects.
|
<T> T |
newInstance(Class<T> pc)
Method to generate an instance of an interface, abstract class, or concrete PC class.
|
<T> javax.jdo.JDOQLTypedQuery<T> |
newJDOQLTypedQuery(Class<T> cls)
Construct a JDOQLTypedQuery instance for the specified candidate.
|
<T> javax.jdo.Query<T> |
newNamedQuery(Class<T> cls,
String queryName)
Construct a query instance with the candidate class and the query name.
|
Object |
newObjectIdInstance(Class pcClass,
Object key)
This method returns an object id instance corresponding to the pcClass and key arguments.
|
javax.jdo.Query |
newQuery()
Construct an empty query instance.
|
<T> javax.jdo.Query<T> |
newQuery(Class<T> cls)
Construct a query instance with the candidate class specified.
|
<T> javax.jdo.Query<T> |
newQuery(Class<T> cls,
Collection<T> cln)
Construct a query instance with the candidate class and candidate
Collection specified.
|
<T> javax.jdo.Query<T> |
newQuery(Class<T> cls,
Collection<T> cln,
String filter)
Construct a query instance with the candidate class, the candidate
Collection, and filter specified.
|
<T> javax.jdo.Query<T> |
newQuery(Class<T> cls,
String filter)
Construct a query instance with the candidate class and filter specified.
|
<T> javax.jdo.Query<T> |
newQuery(javax.jdo.Extent<T> cln)
Construct a query instance with the candidate Extent specified; the
candidate class is taken from the Extent.
|
<T> javax.jdo.Query<T> |
newQuery(javax.jdo.Extent<T> cln,
String filter)
Construct a query instance with the candidate Extent and filter
specified.
|
javax.jdo.Query |
newQuery(Object obj)
Construct a query instance from another query.
|
javax.jdo.Query |
newQuery(String query)
Construct a query instance using the specified Single-String query.
|
javax.jdo.Query |
newQuery(String language,
Object query)
Construct a query instance using the specified language and the specified
query.
|
Object |
putUserObject(Object key,
Object value)
Method to put a user object into the PersistenceManager.
|
void |
refresh(Object obj)
Method to do a refresh of an object.
|
void |
refreshAll()
Method to do a refresh of all objects.
|
void |
refreshAll(Collection pcs)
Method to do a refresh of a collection of objects.
|
void |
refreshAll(javax.jdo.JDOException exc)
Method to do a refresh of objects that failed verification in the
exception.
|
void |
refreshAll(Object... pcs)
Method to do a refresh of an array of objects.
|
void |
removeInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener)
Method to remove a currently registered lifecycle listener, as per JDO 2.0 spec 12.15.
|
void |
removeTransactionEventListener(org.datanucleus.TransactionEventListener listener)
Convenience method to remove the supplied listener from transaction event notification.
|
Object |
removeUserObject(Object key)
Method to remove a user object from the PersistenceManager.
|
void |
retrieve(Object pc)
Method to retrieve the fields of an object.
|
void |
retrieve(Object pc,
boolean useFetchPlan)
Method to retrieve the fields of an object.
|
void |
retrieveAll(boolean useFetchPlan,
Object... pcs)
Retrieve field values of instances from the store.
|
void |
retrieveAll(Collection pcs)
Method to retrieve a collection of objects.
|
void |
retrieveAll(Collection pcs,
boolean useFetchPlan)
Retrieve field values of instances from the store.
|
void |
retrieveAll(Object... pcs)
Method to retrieve an array of objects.
|
void |
setCopyOnAttach(boolean flag)
Mutator for whether to copy objects on attach.
|
void |
setDatastoreReadTimeoutMillis(Integer timeout)
Mutator for the timeout to use for datastore reads.
|
void |
setDatastoreWriteTimeoutMillis(Integer timeout)
Mutator for the timeout to use for datastore writes.
|
void |
setDetachAllOnCommit(boolean flag)
Mutator for whether to detach all objects on commit of the transaction.
|
void |
setIgnoreCache(boolean flag)
Mutator for whether to ignore the cache.
|
void |
setMultithreaded(boolean flag)
Mutator for whether the Persistence Manager is multithreaded.
|
void |
setProperty(String propertyName,
Object value)
Set a persistence manager property.
|
void |
setUserObject(Object userObject)
The application might manage PersistenceManager instances by using an
associated object for bookkeeping purposes.
|
public static final org.datanucleus.util.NucleusLogger LOGGER
protected org.datanucleus.ExecutionContext ec
protected javax.jdo.Transaction jdotx
protected JDOPersistenceManagerFactory pmf
protected JDOFetchPlan fetchPlan
public JDOPersistenceManager(JDOPersistenceManagerFactory pmf, String userName, String password)
pmf
- Persistence Manager FactoryuserName
- Username for the datastore. Note that this is currently ignoredpassword
- Password for the datastore. Note that this is currently ignoredpublic void close()
close
in interface AutoCloseable
close
in interface javax.jdo.PersistenceManager
public boolean isClosed()
isClosed
in interface javax.jdo.PersistenceManager
protected void internalClose()
public org.datanucleus.ExecutionContext getExecutionContext()
public JDOPersistenceManagerFactory getPersistenceManagerFactory()
getPersistenceManagerFactory
in interface javax.jdo.PersistenceManager
public boolean getDetachAllOnCommit()
getDetachAllOnCommit
in interface javax.jdo.PersistenceManager
public boolean getCopyOnAttach()
getCopyOnAttach
in interface javax.jdo.PersistenceManager
public javax.jdo.FetchPlan getFetchPlan()
getFetchPlan
in interface javax.jdo.PersistenceManager
public boolean getIgnoreCache()
getIgnoreCache
in interface javax.jdo.PersistenceManager
public boolean getMultithreaded()
getMultithreaded
in interface javax.jdo.PersistenceManager
public void setDetachAllOnCommit(boolean flag)
setDetachAllOnCommit
in interface javax.jdo.PersistenceManager
flag
- Whether to detach all on commit.public void setCopyOnAttach(boolean flag)
setCopyOnAttach
in interface javax.jdo.PersistenceManager
flag
- Whether to copy on attachingpublic void setIgnoreCache(boolean flag)
setIgnoreCache
in interface javax.jdo.PersistenceManager
flag
- Whether to ignore the cache.public void setMultithreaded(boolean flag)
setMultithreaded
in interface javax.jdo.PersistenceManager
flag
- Whether to run multithreaded.public void setDatastoreReadTimeoutMillis(Integer timeout)
setDatastoreReadTimeoutMillis
in interface javax.jdo.PersistenceManager
timeout
- Datastore read timeout interval (millisecs)public Integer getDatastoreReadTimeoutMillis()
getDatastoreReadTimeoutMillis
in interface javax.jdo.PersistenceManager
public void setDatastoreWriteTimeoutMillis(Integer timeout)
setDatastoreWriteTimeoutMillis
in interface javax.jdo.PersistenceManager
timeout
- Datastore write timeout interval (millisecs)public Integer getDatastoreWriteTimeoutMillis()
getDatastoreWriteTimeoutMillis
in interface javax.jdo.PersistenceManager
public Date getServerDate()
getServerDate
in interface javax.jdo.PersistenceManager
public javax.jdo.Transaction currentTransaction()
currentTransaction
in interface javax.jdo.PersistenceManager
public void evict(Object obj)
evict
in interface javax.jdo.PersistenceManager
obj
- The objectjavax.jdo.JDOUserException
- thrown if some instances could not be evictedpublic void evictAll(boolean subclasses, Class cls)
evictAll
in interface javax.jdo.PersistenceManager
cls
- Type of persistable objectsubclasses
- Whether to include subclassespublic void evictAll(Object... pcs)
evictAll
in interface javax.jdo.PersistenceManager
pcs
- The objectspublic void evictAll(Collection pcs)
evictAll
in interface javax.jdo.PersistenceManager
pcs
- The objectsjavax.jdo.JDOUserException
- thrown if some instances could not be evictedpublic void evictAll()
evictAll
in interface javax.jdo.PersistenceManager
public void refresh(Object obj)
refresh
in interface javax.jdo.PersistenceManager
obj
- The Objectjavax.jdo.JDOUserException
- thrown if the object could not be refreshedpublic void refreshAll(Object... pcs)
refreshAll
in interface javax.jdo.PersistenceManager
pcs
- The Objectspublic void refreshAll(Collection pcs)
refreshAll
in interface javax.jdo.PersistenceManager
pcs
- The Objectsjavax.jdo.JDOUserException
- thrown if instances could not be refreshed.public void refreshAll()
refreshAll
in interface javax.jdo.PersistenceManager
javax.jdo.JDOUserException
- thrown if instances could not be refreshed.public void refreshAll(javax.jdo.JDOException exc)
refreshAll
in interface javax.jdo.PersistenceManager
exc
- The JDO exception containing the objects that failedpublic void retrieve(Object pc, boolean useFetchPlan)
retrieve
in interface javax.jdo.PersistenceManager
pc
- The objectuseFetchPlan
- whether to retrieve only the current fetch plan fieldspublic void retrieve(Object pc)
retrieve
in interface javax.jdo.PersistenceManager
pc
- The objectpublic void retrieveAll(Object... pcs)
retrieveAll
in interface javax.jdo.PersistenceManager
pcs
- The objectspublic void retrieveAll(boolean useFetchPlan, Object... pcs)
retrieveAll
in interface javax.jdo.PersistenceManager
useFetchPlan
- whether to retrieve only the current fetch plan fieldspcs
- the instancespublic void retrieveAll(Collection pcs, boolean useFetchPlan)
PersistenceManager
that the application intends to use the
instances, and their field values should be retrieved. The fields in the
current fetch group must be retrieved, and the implementation might
retrieve more fields than the current fetch group.
The PersistenceManager
might use policy information about
the class to retrieve associated instances.
retrieveAll
in interface javax.jdo.PersistenceManager
pcs
- the instancesuseFetchPlan
- whether to retrieve only the current fetch plan fieldspublic void retrieveAll(Collection pcs)
retrieveAll
in interface javax.jdo.PersistenceManager
pcs
- The objectspublic <T> T makePersistent(T obj)
makePersistent
in interface javax.jdo.PersistenceManager
obj
- The objectpublic <T> T[] makePersistentAll(T... pcs)
makePersistentAll
in interface javax.jdo.PersistenceManager
pcs
- The objects to persistpublic <T> Collection<T> makePersistentAll(Collection<T> pcs)
makePersistentAll
in interface javax.jdo.PersistenceManager
pcs
- The objects to persistpublic void deletePersistent(Object obj)
deletePersistent
in interface javax.jdo.PersistenceManager
obj
- The objectpublic void deletePersistentAll(Object... pcs)
deletePersistentAll
in interface javax.jdo.PersistenceManager
pcs
- The objectsjavax.jdo.JDOUserException
- Thrown if one (or more) object cannot be deletedpublic void deletePersistentAll(Collection pcs)
deletePersistentAll
in interface javax.jdo.PersistenceManager
pcs
- The objectsjavax.jdo.JDOUserException
- Thrown if one (or more) object cannot be deletedpublic void makeTransient(Object pc, boolean useFetchPlan)
makeTransient
in interface javax.jdo.PersistenceManager
pc
- The objectuseFetchPlan
- Whether to make transient all objects in the fetch planpublic void makeTransient(Object pc)
makeTransient
in interface javax.jdo.PersistenceManager
pc
- The objectpublic void makeTransientAll(Object... pcs)
makeTransientAll
in interface javax.jdo.PersistenceManager
pcs
- The objectspublic void makeTransientAll(boolean includeFetchPlan, Object... pcs)
makeTransientAll
in interface javax.jdo.PersistenceManager
includeFetchPlan
- Whether to make transient all objects in the fetch planpcs
- The objectspublic void makeTransientAll(Collection pcs, boolean useFetchPlan)
makeTransientAll
in interface javax.jdo.PersistenceManager
pcs
- The objectsuseFetchPlan
- Whether to use the fetch plan when making transientjavax.jdo.JDOUserException
- thrown if objects could not be made transient.public void makeTransientAll(Collection pcs)
makeTransientAll
in interface javax.jdo.PersistenceManager
pcs
- The objectsjavax.jdo.JDOUserException
- thrown if objects could not be made transient.public void makeTransactional(Object pc)
makeTransactional
in interface javax.jdo.PersistenceManager
pc
- The objectpublic void makeTransactionalAll(Object... pcs)
makeTransactionalAll
in interface javax.jdo.PersistenceManager
pcs
- The objectspublic void makeTransactionalAll(Collection pcs)
makeTransactionalAll
in interface javax.jdo.PersistenceManager
pcs
- The objectsjavax.jdo.JDOUserException
- thrown if objects could not be made transactionalpublic void makeNontransactional(Object pc)
makeNontransactional
in interface javax.jdo.PersistenceManager
pc
- The objectpublic void makeNontransactionalAll(Object... pcs)
makeNontransactionalAll
in interface javax.jdo.PersistenceManager
pcs
- The objects.public void makeNontransactionalAll(Collection pcs)
makeNontransactionalAll
in interface javax.jdo.PersistenceManager
pcs
- The objects.javax.jdo.JDOUserException
- thrown if objects could not be made nontransactionalpublic <T> T detachCopy(T pc)
detachCopy
in interface javax.jdo.PersistenceManager
pc
- The objectpublic <T> T[] detachCopyAll(T... pcs)
PersistenceManager
.
The objects returned can be manipulated and re-attached with
makePersistentAll(Object[])
.
The detached instances will be unmanaged copies of the specified parameters,
and are suitable for serialization and manipulation outside of a JDO environment.
When detaching instances, only fields in the current FetchPlan
will be
traversed. Thus, to detach a graph of objects, relations to other persistent
instances must either be in the default-fetch-group
, or in the
current custom FetchPlan
.detachCopyAll
in interface javax.jdo.PersistenceManager
pcs
- the instances to detachpublic <T> Collection<T> detachCopyAll(Collection<T> pcs)
PersistenceManager
.detachCopyAll
in interface javax.jdo.PersistenceManager
pcs
- the instances to detachdetachCopyAll(Object[])
public javax.jdo.Query newQuery()
newQuery
in interface javax.jdo.PersistenceManager
public javax.jdo.Query newQuery(Object obj)
newQuery
in interface javax.jdo.PersistenceManager
obj
- The object to use in the querypublic javax.jdo.Query newQuery(String query)
newQuery
in interface javax.jdo.PersistenceManager
query
- The single-string querypublic javax.jdo.Query newQuery(String language, Object query)
newQuery
in interface javax.jdo.PersistenceManager
language
- The language parameter for the JDO Query language. This is by default
"javax.jdo.query.JDOQL", but in JDO 2.0 can also be "javax.jdo.query.SQL", or vendor provided languages.query
- The query objectpublic <T> javax.jdo.Query<T> newQuery(Class<T> cls)
newQuery
in interface javax.jdo.PersistenceManager
T
- Candidate type for the querycls
- The class to querypublic <T> javax.jdo.Query<T> newQuery(javax.jdo.Extent<T> cln)
newQuery
in interface javax.jdo.PersistenceManager
T
- Candidate type for the querycln
- The extent to querypublic <T> javax.jdo.Query<T> newQuery(Class<T> cls, Collection<T> cln)
newQuery
in interface javax.jdo.PersistenceManager
T
- Candidate type for the querycls
- The class to querycln
- The collectionpublic <T> javax.jdo.Query<T> newQuery(Class<T> cls, String filter)
newQuery
in interface javax.jdo.PersistenceManager
T
- Candidate type for the querycls
- The class to queryfilter
- A filter to applypublic <T> javax.jdo.Query<T> newQuery(Class<T> cls, Collection<T> cln, String filter)
newQuery
in interface javax.jdo.PersistenceManager
T
- Candidate type for the querycls
- The class to querycln
- A collectionfilter
- A filter to applypublic <T> javax.jdo.Query<T> newQuery(javax.jdo.Extent<T> cln, String filter)
newQuery
in interface javax.jdo.PersistenceManager
T
- Candidate type for the querycln
- The extent to queryfilter
- A filter to applypublic <T> javax.jdo.JDOQLTypedQuery<T> newJDOQLTypedQuery(Class<T> cls)
newJDOQLTypedQuery
in interface javax.jdo.PersistenceManager
T
- Candidate type for the querycls
- Candidate classpublic <T> javax.jdo.Query<T> newNamedQuery(Class<T> cls, String queryName)
newNamedQuery
in interface javax.jdo.PersistenceManager
T
- Candidate type for the querycls
- The class to queryqueryName
- Name of the query.public <T> javax.jdo.Extent<T> getExtent(Class<T> pcClass, boolean subclasses)
getExtent
in interface javax.jdo.PersistenceManager
T
- candidate typepcClass
- The class to querysubclasses
- Whether to include subclasses in the query.public <T> javax.jdo.Extent<T> getExtent(Class<T> pcClass)
getExtent
in interface javax.jdo.PersistenceManager
pcClass
- The class to querypublic <T> T newInstance(Class<T> pc)
newInstance
in interface javax.jdo.PersistenceManager
pc
- The class of the interface or abstract class, or concrete class defined in MetaDatapublic Object newObjectIdInstance(Class pcClass, Object key)
newObjectIdInstance
in interface javax.jdo.PersistenceManager
pcClass
- Class of the persistable to create the OID for.key
- Value of the key for SingleFieldIdentity, or toString() for other casespublic Set getManagedObjects()
getManagedObjects
in interface javax.jdo.PersistenceManager
public Set getManagedObjects(Class... classes)
getManagedObjects
in interface javax.jdo.PersistenceManager
classes
- Classes that we want objects forpublic Set getManagedObjects(EnumSet states)
getManagedObjects
in interface javax.jdo.PersistenceManager
states
- States that we want objects forpublic Set getManagedObjects(EnumSet states, Class... classes)
getManagedObjects
in interface javax.jdo.PersistenceManager
states
- States that we want objects forclasses
- Classes that we want objects forpublic Object getObjectById(Object id)
getObjectById
in interface javax.jdo.PersistenceManager
id
- Id of the object.public Object getObjectById(Object id, boolean validate)
getObjectById
in interface javax.jdo.PersistenceManager
id
- Id of the object.validate
- Whether to validate the object statepublic <T> T getObjectById(Class<T> cls, Object key)
getObjectById
in interface javax.jdo.PersistenceManager
cls
- Class of the persistablekey
- Value of the key field for SingleFieldIdentity, or the string value of the key otherwisepublic Object[] getObjectsById(boolean validate, Object... oids)
getObjectsById
in interface javax.jdo.PersistenceManager
validate
- Whether to validate the object stateoids
- Ids of the objects.public Object[] getObjectsById(Object... oids)
getObjectsById
in interface javax.jdo.PersistenceManager
oids
- Ids of the objects.public Collection getObjectsById(Collection oids)
getObjectsById
in interface javax.jdo.PersistenceManager
oids
- Ids of the objects.public Collection getObjectsById(Collection oids, boolean validate)
getObjectsById
in interface javax.jdo.PersistenceManager
oids
- Ids of the objects.validate
- Whether to validate the object statepublic <T> T getObjectByUnique(Class<T> cls, String[] fieldNames, Object[] fieldValues)
T
- Type of the objectcls
- Class of the persistablefieldNames
- Name(s) of the field(s) making up the unique keyfieldValues
- Value(s) for the field(s) making up the unique keypublic Object getObjectId(Object pc)
getObjectId
in interface javax.jdo.PersistenceManager
pc
- The objectpublic Object getTransactionalObjectId(Object pc)
getTransactionalObjectId
in interface javax.jdo.PersistenceManager
pc
- The objectpublic Class getObjectIdClass(Class cls)
getObjectIdClass
in interface javax.jdo.PersistenceManager
cls
- The class name of the objectpublic Object putUserObject(Object key, Object value)
putUserObject
in interface javax.jdo.PersistenceManager
key
- The key to store the user object undervalue
- The object to storepublic Object getUserObject(Object key)
getUserObject
in interface javax.jdo.PersistenceManager
key
- The key to store the user object underpublic Object removeUserObject(Object key)
removeUserObject
in interface javax.jdo.PersistenceManager
key
- The key whose uder object is to be removed.public void setUserObject(Object userObject)
setUserObject
in interface javax.jdo.PersistenceManager
userObject
- The objectpublic Object getUserObject()
getUserObject
in interface javax.jdo.PersistenceManager
public void flush()
flush
in interface javax.jdo.PersistenceManager
public void checkConsistency()
checkConsistency
in interface javax.jdo.PersistenceManager
public javax.jdo.datastore.Sequence getSequence(String sequenceName)
getSequence
in interface javax.jdo.PersistenceManager
sequenceName
- Fully qualified name of the sequencepublic void addInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener, Class... classes)
addInstanceLifecycleListener
in interface javax.jdo.PersistenceManager
listener
- The instance lifecycle listener to sends events toclasses
- The classes that it is interested inpublic void removeInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener)
removeInstanceLifecycleListener
in interface javax.jdo.PersistenceManager
listener
- The instance lifecycle listener to remove.protected void assertIsOpen()
javax.jdo.JDOFatalUserException
- if the PM is closed.protected void assertActiveTransaction()
protected void assertWritable()
protected void assertReadable(String operation)
operation
- The operationprotected boolean hasPersistenceInformationForClass(Class cls)
cls
- The class to checkpublic javax.jdo.datastore.JDOConnection getDataStoreConnection()
getDataStoreConnection
in interface javax.jdo.PersistenceManager
PersistenceManager.getDataStoreConnection()
public javax.jdo.FetchGroup getFetchGroup(Class cls, String name)
getFetchGroup
in interface javax.jdo.PersistenceManager
cls
- The classname
- The name of the fetch grouppublic void setProperty(String propertyName, Object value)
setProperty
in interface javax.jdo.PersistenceManager
propertyName
- name of propertyvalue
- The valuejavax.jdo.JDOUserException
- if the value is not supported for the propertypublic Map<String,Object> getProperties()
getProperties
in interface javax.jdo.PersistenceManager
public Set<String> getSupportedProperties()
getSupportedProperties
in interface javax.jdo.PersistenceManager
public void addTransactionEventListener(org.datanucleus.TransactionEventListener listener)
listener
- The listener.public void removeTransactionEventListener(org.datanucleus.TransactionEventListener listener)
listener
- The listenerCopyright © 2020. All rights reserved.