org.jpox
Class AbstractPersistenceManager

java.lang.Object
  extended byorg.jpox.AbstractPersistenceManager
All Implemented Interfaces:
PersistenceManager, javax.jdo.PersistenceManager
Direct Known Subclasses:
ManagedConnectionImpl, PersistenceManagerImpl

public abstract class AbstractPersistenceManager
extends java.lang.Object
implements PersistenceManager

This class implements the functionality needed for a JDO persistence manager.

Version:
$Revision: 1.200 $

Field Summary
protected  AbstractPersistenceManagerFactory apmf
          Owning PMF for this PM.
protected  ClassLoaderResolver clr
          The ClassLoader resolver to use for class loading issues.
protected  java.util.List lifecycleListeners
          Lifecycle Listeners for events
protected static Localiser LOCALISER
          Localisation utility for output messages
protected  Transaction tx
          Current transaction
 
Constructor Summary
AbstractPersistenceManager(AbstractPersistenceManagerFactory apmf, java.lang.String userName, java.lang.String password)
          Constructor.
 
Method Summary
 void addInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener, java.lang.Class[] classes)
          Method to register a lifecycle listener as per JDO 2.0 spec 12.15.
 void addQueryResult(QueryResult queryResult)
          Add opened query results to the pm
 void addQueryRun(java.lang.String singleStringQuery)
          Add queries already run to the pm
 void addStateManager(StateManager sm)
          Method to add the object managed by the specified StateManager to the cache.
 java.lang.Object attachCopy(java.lang.Object pc, boolean embedded)
          Method to attach a persistent detached object.
 void checkConsistency()
          This method validates the cache with the datastore.
 void clearDirty()
          Method to mark as clean the StateManager.
 void clearDirty(StateManager sm)
          Method to mark an object (StateManager) as dirty.
 void close()
          Method to close the Persistence Manager.
 javax.jdo.Transaction currentTransaction()
          Accessor for the current transaction.
 void deletePersistent(java.lang.Object obj)
          JDO method to delete an object from the datastore.
 void deletePersistentAll(java.util.Collection pcs)
          JDO method to delete a collection of objects from the datastore.
 void deletePersistentAll(java.lang.Object[] pcs)
          JDO method to delete an array of objects from the datastore.
 java.lang.Object detachCopy(java.lang.Object pc)
          JDO method to detach a persistent object.
 java.util.Collection detachCopyAll(java.util.Collection pcs)
          Detach the specified objects from the PersistenceManager.
 java.lang.Object[] detachCopyAll(java.lang.Object[] pcs)
          Detach the specified objects from the PersistenceManager.
 java.lang.Object detachCopyInternal(java.lang.Object pc, FetchPlanState state)
          Internal method to detach a persistent object using the passed state.
 void detachInternal(java.lang.Object pc, FetchPlanState state)
          Method to detach a persistent object without making a copy.
protected  void disconnectLifecycleListener()
          Disconnect the registered LifecycleListener
protected  void disconnectQueryCache()
          Disconnect Query Results cache to close it, and disconnect the list of queries that has been run
protected  void disconnectSMCache()
          Disconnect SM instances, clear cache and reset settings
 void dump(java.lang.Object obj, java.io.PrintWriter out)
          Diagnostic method to dump out the state of the passed object to the passed PrintWriter.
 void enlistInTransaction(StateManager sm)
          Method to enlist the specified StateManager in the current transaction.
 void evict(java.lang.Object pc)
          Method to evict an object.
 void evictAll()
          Method to evict all current objects.
 void evictAll(java.util.Collection pcs)
          Method to evict a collection of objects.
 void evictAll(java.lang.Object[] pcs)
          Method to evict an array of objects.
 void evictFromTransaction(StateManager sm)
          Method to evict the specified StateManager from the current transaction.
 StateManager findStateManager(javax.jdo.spi.PersistenceCapable pc)
          Method to find the StateManager for an object.
 void flush()
          This method flushes all dirty, new, and deleted instances to the datastore.
 AbstractPersistenceManagerFactory getAbstractPersistenceManagerFactory()
          Accessor for the PersistenceManager Factory.
 ClassLoaderResolver getClassLoaderResolver()
          Accessor for the ClassLoaderResolver
 java.sql.Connection getConnection(boolean forWriting, boolean forQuery)
          Accessor for a Connection for this datastore.
 java.sql.Connection getConnection(boolean forWriting, boolean forQuery, boolean useOpenedConnection)
          Accessor for the connection to the datasource.
 boolean getDetachAllOnCommit()
          Accessor for whether to detach all objects on commit of the transaction.
 boolean getDetachOnClose()
          Accessor for whether to detach objects on close of the PM.
 javax.jdo.Extent getExtent(java.lang.Class pcClass)
          Extents are collections of datastore objects managed by the datastore, not by explicit user operations on collections.
 javax.jdo.Extent getExtent(java.lang.Class pcClass, boolean subclasses)
          Extents are collections of datastore objects managed by the datastore, not by explicit user operations on collections.
 javax.jdo.FetchPlan getFetchPlan()
          Acessor for the current FetchPlan
 boolean getIgnoreCache()
          Accessor for whether to ignore the cache.
 MetaDataManager getMetaDataManager()
          Accessor for the MetaDataManager for this PMF.
 boolean getMultithreaded()
          Accessor for whether the Persistence Manager is multithreaded.
 java.lang.Object getObjectByAID(java.lang.Class pcClass, FieldValues fv, boolean ignoreCache, boolean checkInheritance)
          Accessor for the StateManager of an object given the object AID.
 java.lang.Object getObjectById(java.lang.Class cls, java.lang.Object key)
          Convenience method that exactly matches the behavior of calling pm.getObjectById (pm.newObjectIdInstance (cls, key), true).
 java.lang.Object getObjectById(java.lang.Object id)
          Accessor for an object given the object id.
 java.lang.Object getObjectById(java.lang.Object id, boolean validate)
          Accessor for an object given the object id.
 java.lang.Object getObjectById(java.lang.Object id, boolean validate, boolean checkInheritance)
          Accessor for an object given the object id.
 java.lang.Object getObjectById(java.lang.Object id, FieldValues fv)
          Accessor for an object given the object id.
 java.lang.Object getObjectById(java.lang.Object id, FieldValues fv, java.lang.Class cls, boolean ignoreCache)
          Accessor for an object given the object id.
 javax.jdo.spi.PersistenceCapable getObjectFromCache(java.lang.Object id)
          Convenience method to access an object in the cache.
 java.lang.Object getObjectId(java.lang.Object pc)
          Accessor for an object id given the object.
 java.lang.Class getObjectIdClass(java.lang.Class cls)
          Accessor for the class of the object id given the class of object.
 java.util.Collection getObjectsById(java.util.Collection oids)
          Accessor for the objects given the object ids, validating the objects.
 java.util.Collection getObjectsById(java.util.Collection oids, boolean validate)
          Accessor for the objects given the object ids.
 java.lang.Object[] getObjectsById(java.lang.Object[] oids)
          Accessor for the objects given the object ids, validating the objects.
 java.lang.Object[] getObjectsById(java.lang.Object[] oids, boolean validate)
          Accessor for the objects given the object ids.
 javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory()
          Accessor for the PersistenceManager Factory.
 PMFContext getPMFContext()
          Gets the context in which this PersistenceManager is running
abstract  PersistenceManager getPMHandle()
          Accessor for a handle to this PersistenceManager.
 javax.jdo.datastore.Sequence getSequence(java.lang.String sequenceName)
          Method to retrieve a sequence by name.
 StateManager getStateManagerById(java.lang.Object id)
          Accessor for the StateManager of an object given the object id.
 StoreManager getStoreManager()
          Accessor for the Store Manager.
 java.lang.Object getTransactionalObjectId(java.lang.Object pc)
          Accessor for the object id of a transactional object given the object.
 java.lang.Object getUserObject()
          The application might manage PersistenceManager instances by using an associated object for bookkeeping purposes.
 java.lang.Object getUserObject(java.lang.Object key)
          Method to get a user object from the PersistenceManager.
 boolean hasQueryRun(java.lang.String singleStringQuery)
          Whether the query was already run
 void hereIsStateManager(StateManager sm, javax.jdo.spi.PersistenceCapable pc)
          Method to add the StateManager for an object to this PersistenceManager's list.
 void internalRetrieve(java.lang.Object obj, javax.jdo.FetchPlan fetchPlan)
          Method to retrieve an object (internally).
 boolean isClosed()
          Accessor for whether this Persistence Manager is closed.
 boolean isConnectionOpen()
          Checks whether a connection to the datasource is open.
 boolean isDelayDatastoreOperationsEnabled()
          Whether the datastore operations are delayed until commit.
 boolean isInserting(javax.jdo.spi.PersistenceCapable pc)
          Tests whether this object is in the process of being inserted.
 void makeNontransactional(java.lang.Object pc)
          Method to make nontransactional an object.
 void makeNontransactionalAll(java.util.Collection pcs)
          Method to make nontransactional a collection of objects.
 void makeNontransactionalAll(java.lang.Object[] pcs)
          Method to make nontransactional an array of objects.
 java.lang.Object makePersistent(java.lang.Object obj)
          JDO method to make persistent an object.
 java.util.Collection makePersistentAll(java.util.Collection pcs)
          JDO method to make persistent a collection of objects.
 java.lang.Object[] makePersistentAll(java.lang.Object[] pcs)
          JDO method to make persistent an array of objects.
 java.lang.Object makePersistentInternal(java.lang.Object obj, FieldValues preInsertChanges)
          Internal method to make persistent an object.
 void makeTransactional(java.lang.Object pc)
          Method to make transactional an object.
 void makeTransactionalAll(java.util.Collection pcs)
          Method to make transactional a collection of objects.
 void makeTransactionalAll(java.lang.Object[] pcs)
          Method to make transactional an array of objects.
 void makeTransient(java.lang.Object pc)
          Method to make transient an object.
 void makeTransient(java.lang.Object pc, boolean useFetchPlan)
          Method to make transient an object allowing fetching using the fetch plan.
 void makeTransientAll(java.util.Collection pcs)
          Method to make transient a collection of objects.
 void makeTransientAll(java.util.Collection pcs, boolean useFetchPlan)
          Method to make transient a collection of objects.
 void makeTransientAll(java.lang.Object[] pcs)
          Method to make transient an array of objects.
 void makeTransientAll(java.lang.Object[] pcs, boolean includeFetchPlan)
          Method to make transient an array of objects.
 void makeTransientInternal(java.lang.Object obj, FetchPlanState state)
          Method to make transient an object (internally).
 void markDirty(StateManager sm)
          Method to mark an object (StateManager) as dirty.
 java.lang.Object newInstance(java.lang.Class persistenceCapable)
          Method to generate an instance of an interface, abstract class, or concrete PC class.
 javax.jdo.Query newNamedQuery(java.lang.Class cls, java.lang.String queryName)
          Construct a query instance with the candidate class and the query name.
 java.lang.Object newObjectIdInstance(java.lang.Class pcClass, java.lang.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.
 javax.jdo.Query newQuery(java.lang.Class cls)
          Construct a query instance with the candidate class specified.
 javax.jdo.Query newQuery(java.lang.Class cls, java.util.Collection cln)
          Construct a query instance with the candidate class and candidate Collection specified.
 javax.jdo.Query newQuery(java.lang.Class cls, java.util.Collection cln, java.lang.String filter)
          Construct a query instance with the candidate class, the candidate Collection, and filter specified.
 javax.jdo.Query newQuery(java.lang.Class cls, java.lang.String filter)
          Construct a query instance with the candidate class and filter specified.
 javax.jdo.Query newQuery(javax.jdo.Extent cln)
          Construct a query instance with the candidate Extent specified; the candidate class is taken from the Extent.
 javax.jdo.Query newQuery(javax.jdo.Extent cln, java.lang.String filter)
          Construct a query instance with the candidate Extent and filter specified.
 javax.jdo.Query newQuery(java.lang.Object obj)
          Construct a query instance from another query.
 javax.jdo.Query newQuery(java.lang.String query)
          Construct a query instance using the specified Single-String query.
 javax.jdo.Query newQuery(java.lang.String language, java.lang.Object query)
          Construct a query instance using the specified language and the specified query.
 void notifyLifecycleListenersForEvent(java.lang.Object obj, int lifecycleEventType, java.lang.Object otherObj)
          Utility to notify the lifecycle listeners for an event on an object.
 void postCommit()
          Commit any changes made to objects managed by the persistence manager to the database.
 void preCommit()
          Method to perform any pre-commit checks.
 void preRollback()
          Rollback any changes made to objects managed by the persistence manager to the database.
 void putObjectIntoCache(StateManager sm, boolean level1, boolean level2)
          Convenience method to add an object to the cache(s).
 java.lang.Object putUserObject(java.lang.Object key, java.lang.Object value)
          Method to put a user object into the PersistenceManager.
 void refresh(java.lang.Object pc)
          Method to do a refresh of an object.
 void refreshAll()
          Method to do a refresh of all objects.
 void refreshAll(java.util.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(java.lang.Object[] pcs)
          Method to do a refresh of an array of objects.
 void releaseConnection(java.sql.Connection conn)
          Method to return a Connection for this datastore to the pool.
 void removeAllInstanceLifecycleListeners()
          This method removes all previously registered lifecycle listeners.
 void removeInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener)
          Method to remove a currently registered lifecycle listener, as per JDO 2.0 spec 12.15.
 void removeObjectFromCache(javax.jdo.spi.PersistenceCapable pc, java.lang.Object id, boolean level1, boolean level2)
          Convenience method to evict an object from the cache(s).
 void removeQueryResult(QueryResult queryResult)
          Remove query results from the pm
 void removeQueryRun(java.lang.String singleStringQuery)
          Remove query results from the pm
 void removeStateManager(StateManager sm)
          Method to remove the object managed by the specified StateManager from the cache.
 java.lang.Object removeUserObject(java.lang.Object key)
          Method to remove a user object from the PersistenceManager.
 void replaceObjectId(javax.jdo.spi.PersistenceCapable pc, java.lang.Object oldID, java.lang.Object newID)
          Replace the previous object id for a PC object to a new
protected  void reset()
          Reset the PersistenceManager
 void retrieve(java.lang.Object pc)
          Method to retrieve the fields of an object.
 void retrieve(java.lang.Object pc, boolean fgOnly)
          Method to retrieve the fields of an object.
 void retrieve(java.lang.Object pc, javax.jdo.FetchPlan fetchPlan)
          Method to retrieve the fields of an object.
 void retrieveAll(java.util.Collection pcs)
          Method to retrieve a collection of objects.
 void retrieveAll(java.util.Collection pcs, boolean fgOnly)
          Retrieve field values of instances from the store.
 void retrieveAll(java.lang.Object[] pcs)
          Method to retrieve an array of objects.
 void retrieveAll(java.lang.Object[] pcs, boolean fgOnly)
          Retrieve field values of instances from the store.
 void setDetachAllOnCommit(boolean flag)
          Mutator for whether to detach all objects on commit of the transaction.
 void setDetachOnClose(boolean flag)
          Mutator for whether to detach objects on close of the PM.
 void setIgnoreCache(boolean flag)
          Mutator for whether to ignore the cache.
 void setMultithreaded(boolean flag)
          Mutator for whether the Persistence Manager is multithreaded.
 void setUserObject(java.lang.Object userObject)
          The application might manage PersistenceManager instances by using an associated object for bookkeeping purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jdo.PersistenceManager
getDataStoreConnection
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localisation utility for output messages


apmf

protected final AbstractPersistenceManagerFactory apmf
Owning PMF for this PM.


tx

protected Transaction tx
Current transaction


lifecycleListeners

protected java.util.List lifecycleListeners
Lifecycle Listeners for events


clr

protected ClassLoaderResolver clr
The ClassLoader resolver to use for class loading issues.

Constructor Detail

AbstractPersistenceManager

public AbstractPersistenceManager(AbstractPersistenceManagerFactory apmf,
                                  java.lang.String userName,
                                  java.lang.String password)
Constructor.

Parameters:
apmf - Persistence Manager Factory
userName - Username for the datastore
password - Password for the datastore
Method Detail

getClassLoaderResolver

public ClassLoaderResolver getClassLoaderResolver()
Accessor for the ClassLoaderResolver

Specified by:
getClassLoaderResolver in interface PersistenceManager
Returns:
the ClassLoaderResolver

getStoreManager

public StoreManager getStoreManager()
Accessor for the Store Manager.

Specified by:
getStoreManager in interface PersistenceManager
Returns:
StoreManager

getFetchPlan

public javax.jdo.FetchPlan getFetchPlan()
Acessor for the current FetchPlan

Specified by:
getFetchPlan in interface javax.jdo.PersistenceManager
Returns:
FetchPlan
Since:
1.1

getAbstractPersistenceManagerFactory

public AbstractPersistenceManagerFactory getAbstractPersistenceManagerFactory()
Accessor for the PersistenceManager Factory.

Returns:
The PersistenceManagerFactory

getPersistenceManagerFactory

public javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory()
Accessor for the PersistenceManager Factory.

Specified by:
getPersistenceManagerFactory in interface javax.jdo.PersistenceManager
Returns:
The PersistenceManagerFactory

getPMFContext

public PMFContext getPMFContext()
Gets the context in which this PersistenceManager is running

Specified by:
getPMFContext in interface PersistenceManager
Returns:
Returns the pmfContext.

getMetaDataManager

public MetaDataManager getMetaDataManager()
Accessor for the MetaDataManager for this PMF. This is used as the interface to MetaData in the PM/PMF.

Specified by:
getMetaDataManager in interface PersistenceManager
Returns:
Returns the MetaDataManager.

getPMHandle

public abstract PersistenceManager getPMHandle()
Accessor for a handle to this PersistenceManager.

Specified by:
getPMHandle in interface PersistenceManager
Returns:
The handle for this PM.

isDelayDatastoreOperationsEnabled

public boolean isDelayDatastoreOperationsEnabled()
Whether the datastore operations are delayed until commit. In optimistic transactions this is automatically enabled. If we are committing then will return false since the delay is no longer required.

Specified by:
isDelayDatastoreOperationsEnabled in interface PersistenceManager
Returns:
true if datastore operations are delayed until commit

getConnection

public java.sql.Connection getConnection(boolean forWriting,
                                         boolean forQuery)
                                  throws java.sql.SQLException
Accessor for a Connection for this datastore.

Specified by:
getConnection in interface PersistenceManager
Parameters:
forWriting - Whether the connection can be used for writes
forQuery - Whether the connection is to be used by a query (i.e.JDOQUERY).
Returns:
The Connection to the datastore
Throws:
java.sql.SQLException - Thrown if an error occurs in the creation of the connection.

getConnection

public java.sql.Connection getConnection(boolean forWriting,
                                         boolean forQuery,
                                         boolean useOpenedConnection)
                                  throws java.sql.SQLException
Accessor for the connection to the datasource.

Specified by:
getConnection in interface PersistenceManager
Parameters:
forWriting - Whether the connection is read-only or read-write.
forQuery - Whether the connection is to be used by a query (i.e.JDOQUERY).
useOpenedConnection - whether to use an already opened connection, if one is opened.
Returns:
The Connection
Throws:
java.sql.SQLException - When a problem occurs getting the connection.

isConnectionOpen

public boolean isConnectionOpen()
Checks whether a connection to the datasource is open.

Specified by:
isConnectionOpen in interface PersistenceManager
Returns:
true if the Connection is open

releaseConnection

public void releaseConnection(java.sql.Connection conn)
                       throws java.sql.SQLException
Method to return a Connection for this datastore to the pool.

Specified by:
releaseConnection in interface PersistenceManager
Parameters:
conn - The Connection
Throws:
java.sql.SQLException - Thrown if an error occurs in the release of the connection.

currentTransaction

public javax.jdo.Transaction currentTransaction()
Accessor for the current transaction.

Specified by:
currentTransaction in interface javax.jdo.PersistenceManager
Returns:
The transaction

enlistInTransaction

public void enlistInTransaction(StateManager sm)
Method to enlist the specified StateManager in the current transaction.

Specified by:
enlistInTransaction in interface PersistenceManager
Parameters:
sm - The StateManager

evictFromTransaction

public void evictFromTransaction(StateManager sm)
Method to evict the specified StateManager from the current transaction.

Specified by:
evictFromTransaction in interface PersistenceManager
Parameters:
sm - The StateManager

addStateManager

public void addStateManager(StateManager sm)
Method to add the object managed by the specified StateManager to the cache.

Specified by:
addStateManager in interface PersistenceManager
Parameters:
sm - The StateManager

removeStateManager

public void removeStateManager(StateManager sm)
Method to remove the object managed by the specified StateManager from the cache.

Specified by:
removeStateManager in interface PersistenceManager
Parameters:
sm - The StateManager

getStateManagerById

public StateManager getStateManagerById(java.lang.Object id)
Accessor for the StateManager of an object given the object id.

Specified by:
getStateManagerById in interface PersistenceManager
Parameters:
id - Id of the object.
Returns:
The StateManager

isClosed

public boolean isClosed()
Accessor for whether this Persistence Manager is closed.

Specified by:
isClosed in interface javax.jdo.PersistenceManager
Returns:
Whether this manager is closed.

close

public void close()
Method to close the Persistence Manager.

Specified by:
close in interface javax.jdo.PersistenceManager

disconnectSMCache

protected void disconnectSMCache()
Disconnect SM instances, clear cache and reset settings


reset

protected void reset()
Reset the PersistenceManager


disconnectQueryCache

protected void disconnectQueryCache()
Disconnect Query Results cache to close it, and disconnect the list of queries that has been run


disconnectLifecycleListener

protected void disconnectLifecycleListener()
Disconnect the registered LifecycleListener


evict

public void evict(java.lang.Object pc)
Method to evict an object.

Specified by:
evict in interface javax.jdo.PersistenceManager
Parameters:
pc - The object

evictAll

public void evictAll(java.lang.Object[] pcs)
Method to evict an array of objects.

Specified by:
evictAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - The objects

evictAll

public void evictAll(java.util.Collection pcs)
Method to evict a collection of objects.

Specified by:
evictAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - The objects
Throws:
javax.jdo.JDOUserException - thrown if some instances could not be evicted

evictAll

public void evictAll()
Method to evict all current objects.

Specified by:
evictAll in interface javax.jdo.PersistenceManager

refresh

public void refresh(java.lang.Object pc)
Method to do a refresh of an object.

Specified by:
refresh in interface javax.jdo.PersistenceManager
Parameters:
pc - The Object

refreshAll

public void refreshAll(java.lang.Object[] pcs)
Method to do a refresh of an array of objects.

Specified by:
refreshAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - The Objects

refreshAll

public void refreshAll(java.util.Collection pcs)
Method to do a refresh of a collection of objects.

Specified by:
refreshAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - The Objects
Throws:
javax.jdo.JDOUserException - thrown if instances could not be refreshed.

refreshAll

public void refreshAll()
Method to do a refresh of all objects.

Specified by:
refreshAll in interface javax.jdo.PersistenceManager
Throws:
javax.jdo.JDOUserException - thrown if instances could not be refreshed.

refreshAll

public void refreshAll(javax.jdo.JDOException exc)
Method to do a refresh of objects that failed verification in the exception.

Specified by:
refreshAll in interface javax.jdo.PersistenceManager
Parameters:
exc - The JDO exception containing the objects that failed
Since:
1.1

internalRetrieve

public void internalRetrieve(java.lang.Object obj,
                             javax.jdo.FetchPlan fetchPlan)
Method to retrieve an object (internally).

Parameters:
obj - The object
fetchPlan - the fetch plan to load fields

retrieve

public void retrieve(java.lang.Object pc,
                     boolean fgOnly)
Method to retrieve the fields of an object.

Specified by:
retrieve in interface javax.jdo.PersistenceManager
Parameters:
pc - The object
fgOnly - Whether to retrieve the current fetch group fields only

retrieve

public void retrieve(java.lang.Object pc,
                     javax.jdo.FetchPlan fetchPlan)
Method to retrieve the fields of an object.

Parameters:
pc - The object
fetchPlan - the fetch plan to load fields

retrieve

public void retrieve(java.lang.Object pc)
Method to retrieve the fields of an object.

Specified by:
retrieve in interface javax.jdo.PersistenceManager
Parameters:
pc - The object

retrieveAll

public void retrieveAll(java.lang.Object[] pcs)
Method to retrieve an array of objects.

Specified by:
retrieveAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - The objects

retrieveAll

public void retrieveAll(java.lang.Object[] pcs,
                        boolean fgOnly)
Retrieve field values of instances from the store. This tells the 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.

Specified by:
retrieveAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the instances
fgOnly - whether to retrieve only the current fetch group fields
Since:
JDO1.0.1

retrieveAll

public void retrieveAll(java.util.Collection pcs,
                        boolean fgOnly)
Retrieve field values of instances from the store. This tells the 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.

Specified by:
retrieveAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the instances
fgOnly - whether to retrieve only the current fetch-group fields
Since:
JDO1.0.1

retrieveAll

public void retrieveAll(java.util.Collection pcs)
Method to retrieve a collection of objects. Throws a JDOUserException if instances could not be retrieved.

Specified by:
retrieveAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - The objects

makePersistentInternal

public java.lang.Object makePersistentInternal(java.lang.Object obj,
                                               FieldValues preInsertChanges)
Internal method to make persistent an object. For internal use only

Specified by:
makePersistentInternal in interface PersistenceManager
Parameters:
obj - The object
preInsertChanges - Changes to be made before inserting
Returns:
The persisted object

makePersistent

public java.lang.Object makePersistent(java.lang.Object obj)
JDO method to make persistent an object.

Specified by:
makePersistent in interface javax.jdo.PersistenceManager
Parameters:
obj - The object

makePersistentAll

public java.lang.Object[] makePersistentAll(java.lang.Object[] pcs)
JDO method to make persistent an array of objects.

Specified by:
makePersistentAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - The objects to persist

makePersistentAll

public java.util.Collection makePersistentAll(java.util.Collection pcs)
JDO method to make persistent a collection of objects. Throws a JDOUserException if objects could not be made persistent.

Specified by:
makePersistentAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - The objects to persist

isInserting

public boolean isInserting(javax.jdo.spi.PersistenceCapable pc)
Tests whether this object is in the process of being inserted.

Specified by:
isInserting in interface PersistenceManager
Parameters:
pc - the object to verify the status
Returns:
true if this instance is inserting.

attachCopy

public java.lang.Object attachCopy(java.lang.Object pc,
                                   boolean embedded)
Method to attach a persistent detached object. If the object is of class that is not detachable, a ClassNotDetachableException will be thrown. TODO Merge this with internalMakePersistent().

Specified by:
attachCopy in interface PersistenceManager
Parameters:
pc - The object
embedded - Whether the object is embedded
Returns:
The attached object

deletePersistent

public void deletePersistent(java.lang.Object obj)
JDO method to delete an object from the datastore.

Specified by:
deletePersistent in interface javax.jdo.PersistenceManager
Parameters:
obj - The object

deletePersistentAll

public void deletePersistentAll(java.lang.Object[] pcs)
JDO method to delete an array of objects from the datastore.

Specified by:
deletePersistentAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - The objects

deletePersistentAll

public void deletePersistentAll(java.util.Collection pcs)
JDO method to delete a collection of objects from the datastore. Throws a JDOUserException if objects could not be deleted.

Specified by:
deletePersistentAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - The objects

makeTransientInternal

public void makeTransientInternal(java.lang.Object obj,
                                  FetchPlanState state)
Method to make transient an object (internally).

Specified by:
makeTransientInternal in interface PersistenceManager
Parameters:
obj - The object
state - Object containing the state of the fetch plan process (if any)

makeTransient

public void makeTransient(java.lang.Object pc,
                          boolean useFetchPlan)
Method to make transient an object allowing fetching using the fetch plan.

Specified by:
makeTransient in interface javax.jdo.PersistenceManager
Parameters:
pc - The object
useFetchPlan - Whether to make transient all objects in the fetch plan

makeTransient

public void makeTransient(java.lang.Object pc)
Method to make transient an object. This doesn't use the fetch plan and just makes the specified object transient.

Specified by:
makeTransient in interface javax.jdo.PersistenceManager
Parameters:
pc - The object

makeTransientAll

public void makeTransientAll(java.lang.Object[] pcs)
Method to make transient an array of objects.

Specified by:
makeTransientAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - The objects

makeTransientAll

public void makeTransientAll(java.lang.Object[] pcs,
                             boolean includeFetchPlan)
Method to make transient an array of objects.

Specified by:
makeTransientAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - The objects
includeFetchPlan - Whether to make transient all objects in the fetch plan

makeTransientAll

public void makeTransientAll(java.util.Collection pcs,
                             boolean useFetchPlan)
Method to make transient a collection of objects.

Specified by:
makeTransientAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - The objects
useFetchPlan - Whether to use the fetch plan when making transient
Throws:
javax.jdo.JDOUserException - thrown if objects could not be made transient.

makeTransientAll

public void makeTransientAll(java.util.Collection pcs)
Method to make transient a collection of objects.

Specified by:
makeTransientAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - The objects
Throws:
javax.jdo.JDOUserException - thrown if objects could not be made transient.

makeTransactional

public void makeTransactional(java.lang.Object pc)
Method to make transactional an object.

Specified by:
makeTransactional in interface javax.jdo.PersistenceManager
Parameters:
pc - The object

makeTransactionalAll

public void makeTransactionalAll(java.lang.Object[] pcs)
Method to make transactional an array of objects.

Specified by:
makeTransactionalAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - The objects

makeTransactionalAll

public void makeTransactionalAll(java.util.Collection pcs)
Method to make transactional a collection of objects.

Specified by:
makeTransactionalAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - The objects
Throws:
javax.jdo.JDOUserException - thrown if objects could not be made transactional

makeNontransactional

public void makeNontransactional(java.lang.Object pc)
Method to make nontransactional an object.

Specified by:
makeNontransactional in interface javax.jdo.PersistenceManager
Parameters:
pc - The object

makeNontransactionalAll

public void makeNontransactionalAll(java.lang.Object[] pcs)
Method to make nontransactional an array of objects.

Specified by:
makeNontransactionalAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - The objects.

makeNontransactionalAll

public void makeNontransactionalAll(java.util.Collection pcs)
Method to make nontransactional a collection of objects.

Specified by:
makeNontransactionalAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - The objects.
Throws:
javax.jdo.JDOUserException - thrown if objects could not be made nontransactional

detachInternal

public void detachInternal(java.lang.Object pc,
                           FetchPlanState state)
Method to detach a persistent object without making a copy. Note that also all the objects which are refered to from this object are detached. If the object is of class that is not detachable a ClassNotDetachableException will be thrown. If the object is not persistent a JDOUserException is thrown. For internal use only

Specified by:
detachInternal in interface PersistenceManager
Parameters:
pc - The object
state - State for the detachment process

detachCopyInternal

public java.lang.Object detachCopyInternal(java.lang.Object pc,
                                           FetchPlanState state)
Internal method to detach a persistent object using the passed state. If the object is of class that is not detachable a ClassNotDetachableException will be thrown. If the object is not persistent a JDOUserException is thrown. For internal use only

Specified by:
detachCopyInternal in interface PersistenceManager
Parameters:
pc - The object
state - The detached state
Returns:
The detached object

detachCopy

public java.lang.Object detachCopy(java.lang.Object pc)
JDO method to detach a persistent object. If the object is of class that is not detachable a ClassNotDetachableException will be thrown. If the object is not persistent a JDOUserException is thrown.

Specified by:
detachCopy in interface javax.jdo.PersistenceManager
Parameters:
pc - The object
Returns:
The detached object

detachCopyAll

public java.lang.Object[] detachCopyAll(java.lang.Object[] pcs)
Detach the specified objects from the 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.

Specified by:
detachCopyAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the instances to detach
Returns:
the detached instances
Throws:
javax.jdo.JDOUserException - if any of the instances do not
ClassNotDetachableException - If any of the objects are of a class that is not detachable
Since:
JDO 2.0

detachCopyAll

public java.util.Collection detachCopyAll(java.util.Collection pcs)
Detach the specified objects from the PersistenceManager.

Specified by:
detachCopyAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the instances to detach
Returns:
the detached instances
Since:
JDO 2.0
See Also:
detachCopyAll(Object[])

newQuery

public javax.jdo.Query newQuery()
Construct an empty query instance.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Returns:
The query

newQuery

public javax.jdo.Query newQuery(java.lang.Object obj)
Construct a query instance from another query. The parameter might be a serialized/restored Query instance from the same JDO vendor but a different execution environment, or the parameter might be currently bound to a PersistenceManager from the same JDO vendor. Any of the elements Class, Filter, IgnoreCache flag, Import declarations, Variable declarations, Parameter declarations, and Ordering from the parameter Query are copied to the new Query instance, but a candidate Collection or Extent element is discarded.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
obj - The object to use in the query
Returns:
The query

newQuery

public javax.jdo.Query newQuery(java.lang.String query)
Construct a query instance using the specified Single-String query.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
query - The single-string query
Returns:
The Query

newQuery

public javax.jdo.Query newQuery(java.lang.String language,
                                java.lang.Object query)
Construct a query instance using the specified language and the specified query. The query instance will be of a class defined by the query language.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
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 object
Returns:
The query

newQuery

public javax.jdo.Query newQuery(java.lang.Class cls)
Construct a query instance with the candidate class specified.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
cls - The class to query
Returns:
The query

newQuery

public javax.jdo.Query newQuery(javax.jdo.Extent cln)
Construct a query instance with the candidate Extent specified; the candidate class is taken from the Extent.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
cln - The extent to query
Returns:
The query

newQuery

public javax.jdo.Query newQuery(java.lang.Class cls,
                                java.util.Collection cln)
Construct a query instance with the candidate class and candidate Collection specified.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
cls - The class to query
cln - The collection
Returns:
The query

newQuery

public javax.jdo.Query newQuery(java.lang.Class cls,
                                java.lang.String filter)
Construct a query instance with the candidate class and filter specified.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
cls - The class to query
filter - A filter to apply
Returns:
The query

newQuery

public javax.jdo.Query newQuery(java.lang.Class cls,
                                java.util.Collection cln,
                                java.lang.String filter)
Construct a query instance with the candidate class, the candidate Collection, and filter specified.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
cls - The class to query
cln - A collection
filter - A filter to apply
Returns:
The query

newQuery

public javax.jdo.Query newQuery(javax.jdo.Extent cln,
                                java.lang.String filter)
Construct a query instance with the candidate Extent and filter specified. The candidate class is taken from the Extent.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
cln - The extent to query
filter - A filter to apply
Returns:
The query

newNamedQuery

public javax.jdo.Query newNamedQuery(java.lang.Class cls,
                                     java.lang.String queryName)
Construct a query instance with the candidate class and the query name.

Specified by:
newNamedQuery in interface javax.jdo.PersistenceManager
Parameters:
cls - The class to query
queryName - Name of the query.
Returns:
The query

getExtent

public javax.jdo.Extent getExtent(java.lang.Class pcClass,
                                  boolean subclasses)
Extents are collections of datastore objects managed by the datastore, not by explicit user operations on collections. Extent capability is a boolean property of classes that are persistence capable. If an instance of a class that has a managed extent is made persistent via reachability, the instance is put into the extent implicitly.

Specified by:
getExtent in interface javax.jdo.PersistenceManager
Parameters:
pcClass - The class to query
subclasses - Whether to include subclasses in the query.
Returns:
returns an Extent that contains all of the instances in the parameter class, and if the subclasses flag is true, all of the instances of the parameter class and its subclasses.

getExtent

public javax.jdo.Extent getExtent(java.lang.Class pcClass)
Extents are collections of datastore objects managed by the datastore, not by explicit user operations on collections. Extent capability is a boolean property of classes that are persistence capable. If an instance of a class that has a managed extent is made persistent via reachability, the instance is put into the extent implicitly.

Specified by:
getExtent in interface javax.jdo.PersistenceManager
Parameters:
pcClass - The class to query
Returns:
returns an Extent that contains all of the instances in the parameter class, and all of the instances of the parameter class and its subclasses.
Since:
1.1

newInstance

public java.lang.Object newInstance(java.lang.Class persistenceCapable)
Method to generate an instance of an interface, abstract class, or concrete PC class.

Specified by:
newInstance in interface javax.jdo.PersistenceManager
Parameters:
persistenceCapable - The class of the interface or abstract class, or concrete class defined in MetaData
Returns:
The instance of this type

newObjectIdInstance

public java.lang.Object newObjectIdInstance(java.lang.Class pcClass,
                                            java.lang.Object key)
This method returns an object id instance corresponding to the pcClass and key arguments. It has 2 modes of operation. Where SingleFieldIdentity is being used the key is the value of the key field. For all other cases the key is the String form of the object id instance.

Specified by:
newObjectIdInstance in interface javax.jdo.PersistenceManager
Parameters:
pcClass - Class of the PersistenceCapable to create the OID for.
key - Value of the key for SingleFieldIdentity
Returns:
The new object-id instance

getObjectByAID

public java.lang.Object getObjectByAID(java.lang.Class pcClass,
                                       FieldValues fv,
                                       boolean ignoreCache,
                                       boolean checkInheritance)
Accessor for the StateManager of an object given the object AID.

Specified by:
getObjectByAID in interface PersistenceManager
Parameters:
pcClass - The class of the PC object
fv - The field values to be loaded
ignoreCache - true if it must ignore the cache
checkInheritance - Whether look to the database to determine which class this object is. This parameter is a hint. Set false, if it's already determined the correct pcClass for this pc "object" in a certain level in the hierarchy. Set to true and it will look to the database.
Returns:
Object

getObjectById

public java.lang.Object getObjectById(java.lang.Object id,
                                      FieldValues fv,
                                      java.lang.Class cls,
                                      boolean ignoreCache)
Accessor for an object given the object id.

Specified by:
getObjectById in interface PersistenceManager
Parameters:
id - Id of the object.
fv - Field values for the object
cls - the type which the object is. This type will be used to instanciat the object
ignoreCache - true if it must ignore the cache
Returns:
The Object

getObjectById

public java.lang.Object getObjectById(java.lang.Object id)
Accessor for an object given the object id.

Specified by:
getObjectById in interface javax.jdo.PersistenceManager
Parameters:
id - Id of the object.
Returns:
The Object
Since:
1.1

getObjectById

public java.lang.Object getObjectById(java.lang.Object id,
                                      boolean validate)
Accessor for an object given the object id.

Specified by:
getObjectById in interface javax.jdo.PersistenceManager
Parameters:
id - Id of the object.
validate - Whether to validate the object state
Returns:
The Object

getObjectById

public java.lang.Object getObjectById(java.lang.Object id,
                                      boolean validate,
                                      boolean checkInheritance)
Accessor for an object given the object id. If validate is false, we return the object if found in the cache, or otherwise a Hollow object with that id. If validate is true we check with the datastore and return an object with the FetchPlan fields loaded (unless the object doesnt exist in the datastore, where we throw an ObjectNotFoundException).

Specified by:
getObjectById in interface PersistenceManager
Parameters:
id - Id of the object.
validate - Whether to validate the object state
checkInheritance - Whether look to the database to determine which class this object is.
Returns:
The Object with this id

getObjectsById

public java.util.Collection getObjectsById(java.util.Collection oids,
                                           boolean validate)
Accessor for the objects given the object ids.

Specified by:
getObjectsById in interface javax.jdo.PersistenceManager
Parameters:
oids - Ids of the objects.
validate - Whether to validate the object state
Returns:
The Objects with these ids (in the same order)
Since:
1.1

getObjectsById

public java.lang.Object[] getObjectsById(java.lang.Object[] oids,
                                         boolean validate)
Accessor for the objects given the object ids.

Specified by:
getObjectsById in interface javax.jdo.PersistenceManager
Parameters:
oids - Ids of the objects.
validate - Whether to validate the object state
Returns:
The Objects with these ids (in the same order)
Since:
1.1

getObjectsById

public java.util.Collection getObjectsById(java.util.Collection oids)
Accessor for the objects given the object ids, validating the objects.

Specified by:
getObjectsById in interface javax.jdo.PersistenceManager
Parameters:
oids - Ids of the objects.
Returns:
The Objects with these ids (in the same order)
Since:
1.1

getObjectsById

public java.lang.Object[] getObjectsById(java.lang.Object[] oids)
Accessor for the objects given the object ids, validating the objects.

Specified by:
getObjectsById in interface javax.jdo.PersistenceManager
Parameters:
oids - Ids of the objects.
Returns:
The Objects with these ids (in the same order)
Since:
1.1

getObjectById

public java.lang.Object getObjectById(java.lang.Class cls,
                                      java.lang.Object key)
Convenience method that exactly matches the behavior of calling pm.getObjectById (pm.newObjectIdInstance (cls, key), true).

Specified by:
getObjectById in interface javax.jdo.PersistenceManager
Parameters:
cls - Class of the PersistenceCapable
key - Value of the key field for SingleFieldIdentity, or the string value of the key otherwise
Returns:
The object for this id.
Since:
1.1

getObjectById

public java.lang.Object getObjectById(java.lang.Object id,
                                      FieldValues fv)
Accessor for an object given the object id. Checks the inheritance level of the object

Specified by:
getObjectById in interface PersistenceManager
Parameters:
id - Id of the object.
fv - Field values for the object
Returns:
The Object

getObjectId

public java.lang.Object getObjectId(java.lang.Object pc)
Accessor for an object id given the object.

Specified by:
getObjectId in interface javax.jdo.PersistenceManager
Parameters:
pc - The object
Returns:
The Object id

getTransactionalObjectId

public java.lang.Object getTransactionalObjectId(java.lang.Object pc)
Accessor for the object id of a transactional object given the object.

Specified by:
getTransactionalObjectId in interface javax.jdo.PersistenceManager
Parameters:
pc - The object
Returns:
The Object id

putUserObject

public java.lang.Object putUserObject(java.lang.Object key,
                                      java.lang.Object value)
Method to put a user object into the PersistenceManager. This is so that multiple users can each have a user object for example. The parameter is not inspected or used in any way by the JDO implementation.

Specified by:
putUserObject in interface javax.jdo.PersistenceManager
Parameters:
key - The key to store the user object under
value - The object to store
Returns:
The previous value for this key
Since:
1.1

getUserObject

public java.lang.Object getUserObject(java.lang.Object key)
Method to get a user object from the PersistenceManager. This is for user objects which are stored under a key. The parameter is not inspected or used in any way by the JDO implementation.

Specified by:
getUserObject in interface javax.jdo.PersistenceManager
Parameters:
key - The key to store the user object under
Returns:
The user object for that key
Since:
1.1

removeUserObject

public java.lang.Object removeUserObject(java.lang.Object key)
Method to remove a user object from the PersistenceManager. This is for user objects which are stored under a key. The parameter is not inspected or used in any way by the JDO implementation.

Specified by:
removeUserObject in interface javax.jdo.PersistenceManager
Parameters:
key - The key whose uder object is to be removed.
Returns:
The user object that was removed
Since:
1.1

setUserObject

public void setUserObject(java.lang.Object userObject)
The application might manage PersistenceManager instances by using an associated object for bookkeeping purposes. These methods allow the user to manage the associated object. The parameter is not inspected or used in any way by the JDO implementation.

Specified by:
setUserObject in interface javax.jdo.PersistenceManager
Parameters:
userObject - The object

getUserObject

public java.lang.Object getUserObject()
The application might manage PersistenceManager instances by using an associated object for bookkeeping purposes. These methods allow the user to manage the associated object. The parameter is not inspected or used in any way by the JDO implementation.

Specified by:
getUserObject in interface javax.jdo.PersistenceManager
Returns:
The user object

getObjectIdClass

public java.lang.Class getObjectIdClass(java.lang.Class cls)
Accessor for the class of the object id given the class of object.

Specified by:
getObjectIdClass in interface javax.jdo.PersistenceManager
Parameters:
cls - The class name of the object
Returns:
The class name of the object id

setMultithreaded

public void setMultithreaded(boolean flag)
Mutator for whether the Persistence Manager is multithreaded.

Specified by:
setMultithreaded in interface javax.jdo.PersistenceManager
Parameters:
flag - Whether to run multithreaded.

getMultithreaded

public boolean getMultithreaded()
Accessor for whether the Persistence Manager is multithreaded.

Specified by:
getMultithreaded in interface javax.jdo.PersistenceManager
Returns:
Whether to run multithreaded.

setIgnoreCache

public void setIgnoreCache(boolean flag)
Mutator for whether to ignore the cache.

Specified by:
setIgnoreCache in interface javax.jdo.PersistenceManager
Parameters:
flag - Whether to ignore the cache.

getIgnoreCache

public boolean getIgnoreCache()
Accessor for whether to ignore the cache.

Specified by:
getIgnoreCache in interface javax.jdo.PersistenceManager
Returns:
Whether to ignore the cache.

setDetachOnClose

public void setDetachOnClose(boolean flag)
Mutator for whether to detach objects on close of the PM. This is a JPOX extension and will not work when in JCA mode.

Parameters:
flag - Whether to detach on close.

getDetachOnClose

public boolean getDetachOnClose()
Accessor for whether to detach objects on close of the PM. This is a JPOX extension and will not work when in JCA mode.

Returns:
Whether to detach on close.

setDetachAllOnCommit

public void setDetachAllOnCommit(boolean flag)
Mutator for whether to detach all objects on commit of the transaction.

Specified by:
setDetachAllOnCommit in interface javax.jdo.PersistenceManager
Parameters:
flag - Whether to detach all on commit.

getDetachAllOnCommit

public boolean getDetachAllOnCommit()
Accessor for whether to detach all objects on commit of the transaction.

Specified by:
getDetachAllOnCommit in interface javax.jdo.PersistenceManager
Returns:
Whether to detach all on commit.

findStateManager

public StateManager findStateManager(javax.jdo.spi.PersistenceCapable pc)
Method to find the StateManager for an object.

Specified by:
findStateManager in interface PersistenceManager
Parameters:
pc - The object
Returns:
The StateManager, null if StateManager not found. see JDO spec for the calling behavior when null is returned

hereIsStateManager

public void hereIsStateManager(StateManager sm,
                               javax.jdo.spi.PersistenceCapable pc)
Method to add the StateManager for an object to this PersistenceManager's list.

Specified by:
hereIsStateManager in interface PersistenceManager
Parameters:
sm - The StateManager
pc - The object managed by the StateManager

clearDirty

public void clearDirty(StateManager sm)
Method to mark an object (StateManager) as dirty.

Specified by:
clearDirty in interface PersistenceManager
Parameters:
sm - The StateManager

markDirty

public void markDirty(StateManager sm)
Method to mark an object (StateManager) as dirty.

Specified by:
markDirty in interface PersistenceManager
Parameters:
sm - The StateManager

clearDirty

public void clearDirty()
Method to mark as clean the StateManager.


flush

public void flush()
This method flushes all dirty, new, and deleted instances to the datastore. It has no effect if a transaction is not active. If a datastore transaction is active, this method synchronizes the cache with the datastore and reports any exceptions. If an optimistic transaction is active, this method obtains a datastore connection and synchronizes the cache with the datastore using this connection. The connection obtained by this method is held until the end of the transaction.

Specified by:
flush in interface javax.jdo.PersistenceManager

checkConsistency

public void checkConsistency()
This method validates the cache with the datastore. It has no effect if a transaction is not active. If a datastore transaction is active, this method verifies the consistency of instances in the cache against the datastore. An implementation might flush instances as if flush() were called, but it is not required to do so. If an optimistic transaction is active, this method obtains a datastore connection and verifies the consistency of the instances in the cache against the datastore. If any inconsistencies are detected, a JDOOptimisticVerificationException is thrown. This exception contains a nested JDOOptimisticVerificationException for each object that failed the consistency check. No datastore resources acquired during the execution of this method are held beyond the scope of this method.

Specified by:
checkConsistency in interface javax.jdo.PersistenceManager

preCommit

public void preCommit()
Method to perform any pre-commit checks.


postCommit

public void postCommit()
Commit any changes made to objects managed by the persistence manager to the database.


preRollback

public void preRollback()
Rollback any changes made to objects managed by the persistence manager to the database.


dump

public void dump(java.lang.Object obj,
                 java.io.PrintWriter out)
Diagnostic method to dump out the state of the passed object to the passed PrintWriter.

Specified by:
dump in interface PersistenceManager
Parameters:
obj - The PersistenceCapable object
out - The PrintWriter

getSequence

public javax.jdo.datastore.Sequence getSequence(java.lang.String sequenceName)
Method to retrieve a sequence by name. As per JDO2 spec section 12.14 If the named sequence is not known, throws a JDOUserException.

Specified by:
getSequence in interface javax.jdo.PersistenceManager
Parameters:
sequenceName - Fully qualified name of the sequence
Returns:
The sequence

replaceObjectId

public void replaceObjectId(javax.jdo.spi.PersistenceCapable pc,
                            java.lang.Object oldID,
                            java.lang.Object newID)
Replace the previous object id for a PC object to a new

Specified by:
replaceObjectId in interface PersistenceManager
Parameters:
pc - The Persistence Capable object
oldID - the old id
newID - the new id

putObjectIntoCache

public void putObjectIntoCache(StateManager sm,
                               boolean level1,
                               boolean level2)
Convenience method to add an object to the cache(s).

Specified by:
putObjectIntoCache in interface PersistenceManager
Parameters:
sm - The State Manager
level1 - Whether to put it in the L1 cache
level2 - Whether to put it in the L2 cache

removeObjectFromCache

public void removeObjectFromCache(javax.jdo.spi.PersistenceCapable pc,
                                  java.lang.Object id,
                                  boolean level1,
                                  boolean level2)
Convenience method to evict an object from the cache(s).

Specified by:
removeObjectFromCache in interface PersistenceManager
Parameters:
pc - The PersistenceCapable object
id - The PersistenceCapable object id
level1 - Whether to evict from the L1 cache
level2 - Whether to evict from the L2 cache

getObjectFromCache

public javax.jdo.spi.PersistenceCapable getObjectFromCache(java.lang.Object id)
Convenience method to access an object in the cache. Firstly looks in the L1 cache for this PM, and if not found looks in the L2 cache.

Parameters:
id - Id of the object
Returns:
Persistence Capable object (with connected StateManager).

removeAllInstanceLifecycleListeners

public void removeAllInstanceLifecycleListeners()
This method removes all previously registered lifecycle listeners. It is necessary to make sure, that a cached PM (in j2ee environment) will have no listener before the listeners are copied from the PMF. Otherwise they might be registered multiple times.


addInstanceLifecycleListener

public void addInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener,
                                         java.lang.Class[] classes)
Method to register a lifecycle listener as per JDO 2.0 spec 12.15.

Specified by:
addInstanceLifecycleListener in interface javax.jdo.PersistenceManager
Parameters:
listener - The instance lifecycle listener to sends events to
classes - The classes that it is interested in
Since:
1.1

removeInstanceLifecycleListener

public void removeInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener)
Method to remove a currently registered lifecycle listener, as per JDO 2.0 spec 12.15.

Specified by:
removeInstanceLifecycleListener in interface javax.jdo.PersistenceManager
Parameters:
listener - The instance lifecycle listener to remove.
Since:
1.1

notifyLifecycleListenersForEvent

public void notifyLifecycleListenersForEvent(java.lang.Object obj,
                                             int lifecycleEventType,
                                             java.lang.Object otherObj)
Utility to notify the lifecycle listeners for an event on an object. JDO 2.0 spec 12.15 "LifecycleListeners".

Specified by:
notifyLifecycleListenersForEvent in interface PersistenceManager
Parameters:
obj - The object that had the operation performed on it
lifecycleEventType - The lifecycle event
otherObj - Other object associated with the event (if any)
Since:
1.1

addQueryResult

public void addQueryResult(QueryResult queryResult)
Description copied from interface: PersistenceManager
Add opened query results to the pm

Specified by:
addQueryResult in interface PersistenceManager
Parameters:
queryResult - The result to add

removeQueryResult

public void removeQueryResult(QueryResult queryResult)
Description copied from interface: PersistenceManager
Remove query results from the pm

Specified by:
removeQueryResult in interface PersistenceManager
Parameters:
queryResult - The result to remove

addQueryRun

public void addQueryRun(java.lang.String singleStringQuery)
Description copied from interface: PersistenceManager
Add queries already run to the pm

Specified by:
addQueryRun in interface PersistenceManager
Parameters:
singleStringQuery -

hasQueryRun

public boolean hasQueryRun(java.lang.String singleStringQuery)
Description copied from interface: PersistenceManager
Whether the query was already run

Specified by:
hasQueryRun in interface PersistenceManager
Parameters:
singleStringQuery -
Returns:
true if the query was run previously by this PersistenceManager

removeQueryRun

public void removeQueryRun(java.lang.String singleStringQuery)
Description copied from interface: PersistenceManager
Remove query results from the pm

Specified by:
removeQueryRun in interface PersistenceManager
Parameters:
singleStringQuery -


Copyright © -2007 . All Rights Reserved.