public class PersistenceManagerWrapper extends Object implements PersistenceManager
| Modifier and Type | Method and Description |
|---|---|
void |
close()
A PersistenceManager instance can be used until it is closed.
|
Transaction |
currentTransaction()
There is exactly one Transaction associated with a PersistenceManager.
|
void |
deletePersistent(Collection pcs)
Delete a Collection of instances from the data store.
|
void |
deletePersistent(Object pc)
Delete the persistent instance from the data store.
|
void |
deletePersistent(Object[] pcs)
Delete an array of instances from the data store.
|
Collection |
getExtent(Class persistenceCapableClass,
boolean subclasses)
The PersistenceManager may manage a collection of instances in the data
store based on the class of the instances.
|
Object |
getObjectById(Object oid)
This method locates a persistent instance in the cache of instances
managed by this PersistenceManager.
|
Object |
getObjectById(Object oid,
boolean validate)
This method locates a persistent instance in the cache of instances
managed by this
PersistenceManager. |
Object |
getObjectId(Object pc)
The ObjectId returned by this method represents the JDO identity of
the instance.
|
Class |
getObjectIdClass(Class cls)
In order for the application to construct instance of the ObjectId class
it needs to know the class being used by the JDO implementation.
|
PersistenceManager |
getPersistenceManager() |
PersistenceManagerFactory |
getPersistenceManagerFactory()
This method returns the PersistenceManagerFactory used to create
this PersistenceManager.
|
Properties |
getProperties()
The JDO vendor might store certain non-operational properties and
make those properties available to applications (for troubleshooting).
|
boolean |
getRequireCopyObjectId()
Returns the boolean value of the requireCopyObjectId flag
for this PersistenceManager.
|
boolean |
getRequireTrackedSCO()
Returns the boolean value of the requireTrackedSCO flag
for this PersistenceManager.
|
boolean |
getSupersedeDeletedInstance()
Returns the boolean value of the supersedeDeletedInstance flag
for this PersistenceManager.
|
Object |
getTransactionalInstance(Object pc)
This method is used to get a PersistenceCapable instance
representing the same data store object as the parameter, that is valid
for this PersistenceManager.
|
Object |
getUserObject()
The application can manage the PersistenceManager instances
more easily by having an application object associated with each
PersistenceManager instance.
|
boolean |
isClosed()
A PersistenceManager instance can be used until it is closed.
|
void |
makePersistent(Collection pcs)
Make a Collection of instances persistent.
|
void |
makePersistent(Object pc)
Make the transient instance persistent in this PersistenceManager.
|
void |
makePersistent(Object[] pcs)
Make an array of instances persistent.
|
Object |
newCollectionInstance(Class type,
Object owner,
String fieldName,
Class elementType,
boolean allowNulls,
int initialSize)
Returns a new Collection instance of the type specified, with the
owner and field name to notify upon changes to the value of any of its fields.
|
Query |
newQuery()
Create a new Query with no elements.
|
Query |
newQuery(Class cls)
Create a new Query specifying the Class of the results.
|
Query |
newQuery(Class cls,
Collection cln)
Create a new Query with the Class of the results and candidate Collection.
|
Query |
newQuery(Class cls,
Collection cln,
String filter)
Create a new Query with the Class of the results, candidate Collection,
and Filter.
|
Query |
newQuery(Class cls,
String filter)
Create a new Query with the Class of the results and Filter.
|
Query |
newQuery(Object compiled)
Create a new Query using elements from another Query.
|
Object |
newSCOInstance(Class type,
Object owner,
String fieldName)
Returns a new Second Class Object instance of the type specified,
with the owner and field name to notify upon changes to the value
of any of its fields.
|
void |
setRequireCopyObjectId(boolean flag)
Sets the requireCopyObjectId flag for this PersistenceManager.
|
void |
setRequireTrackedSCO(boolean flag)
Sets the requireTrackedSCO flag for this PersistenceManager.
|
void |
setSupersedeDeletedInstance(boolean flag)
Sets the supersedeDeletedInstance flag for this PersistenceManager.
|
void |
setUserObject(Object o)
The application can manage the PersistenceManager instances
more easily by having an application object associated with each
PersistenceManager instance.
|
public boolean isClosed()
isClosed in interface PersistenceManagerclose()public void close()
This method closes the PersistenceManager, which if pooled, releases it to the pool of available PersistenceManagers.
close in interface PersistenceManagerpublic Transaction currentTransaction()
currentTransaction in interface PersistenceManagerpublic Query newQuery()
newQuery in interface PersistenceManagerpublic Query newQuery(Object compiled)
newQuery in interface PersistenceManagercompiled - another Query from the same JDO implementationpublic Query newQuery(Class cls)
newQuery in interface PersistenceManagercls - the Class of the resultspublic Query newQuery(Class cls, Collection cln)
newQuery in interface PersistenceManagercls - the Class of resultscln - the Collection of candidate instancespublic Query newQuery(Class cls, String filter)
newQuery in interface PersistenceManagercls - the Class of resultsfilter - the Filter for candidate instancespublic Query newQuery(Class cls, Collection cln, String filter)
newQuery in interface PersistenceManagercls - the Class of resultscln - the Collection of candidate instancesfilter - the Filter for candidate instancespublic Collection getExtent(Class persistenceCapableClass, boolean subclasses)
getExtent in interface PersistenceManagerpersistenceCapableClass - Class of instancessubclasses - whether to include instances of subclassesQuerypublic Object getObjectById(Object oid)
If the instance does not exist in the data store, then this method will not fail. However, a request to access fields of the instance will throw an exception.
getObjectById in interface PersistenceManageroid - an ObjectIdpublic Object getObjectById(Object oid, boolean validate)
PersistenceManager.
The getObjectById method attempts
to find an instance in the cache with the specified JDO identity.
The oid parameter object might have been returned by an earlier call
to getObjectId or might have been constructed by the application.
If the PersistenceManager is unable to resolve the oid parameter
to an ObjectId instance, then it throws a JDOUserException.
If the validate flag is false, and there is already an instance in the
cache with the same JDO identity as the oid parameter, then this method
returns it. There is no change made to the state of the returned
instance.
If there is not an instance already in the cache with the same JDO
identity as the oid parameter, then this method creates an instance
with the specified JDO identity and returns it. If there is no
transaction in progress, the returned instance will be hollow or
persistent-nontransactional, at the choice of the implementation.
If there is a transaction in progress, the returned instance will be hollow, persistent-nontransactional, or persistent-clean, at the choice of the implementation.
getObjectById in interface PersistenceManageroid - an ObjectIdvalidate - if the existence of the instance is to be validatedPersistenceCapable instance with the specified ObjectIdgetObjectId(Object pc)public Object getObjectId(Object pc)
getObjectId in interface PersistenceManagerpc - the PersistenceCapable instancepublic Object getTransactionalInstance(Object pc)
getTransactionalInstance in interface PersistenceManagerpc - a PersistenceCapable instancepublic void makePersistent(Object pc)
makePersistent in interface PersistenceManagerpc - a transient instance of a Class that implements
PersistenceCapablepublic void makePersistent(Object[] pcs)
makePersistent in interface PersistenceManagerpcs - an array of transient instancesmakePersistent(Object pc)public void makePersistent(Collection pcs)
makePersistent in interface PersistenceManagerpcs - a Collection of transient instancesmakePersistent(Object pc)public void deletePersistent(Object pc)
deletePersistent in interface PersistenceManagerpc - a persistent instancepublic void deletePersistent(Object[] pcs)
deletePersistent in interface PersistenceManagerpcs - a Collection of persistent instancesdeletePersistent(Object pc)public void deletePersistent(Collection pcs)
deletePersistent in interface PersistenceManagerpcs - a Collection of persistent instancesdeletePersistent(Object pc)public PersistenceManagerFactory getPersistenceManagerFactory()
getPersistenceManagerFactory in interface PersistenceManagerpublic void setUserObject(Object o)
setUserObject in interface PersistenceManagero - the user instance to be remembered by the PersistenceManagergetUserObject()public Object getUserObject()
getUserObject in interface PersistenceManagersetUserObject(java.lang.Object)public Properties getProperties()
Standard properties include:
getProperties in interface PersistenceManagerpublic boolean getSupersedeDeletedInstance()
getSupersedeDeletedInstance in interface PersistenceManagerpublic void setSupersedeDeletedInstance(boolean flag)
setSupersedeDeletedInstance in interface PersistenceManagerflag - boolean supersedeDeletedInstance flagpublic boolean getRequireCopyObjectId()
PersistenceManager.getObjectId(Object pc)
and PersistenceManager.getObjectById(Object oid) requests.getRequireCopyObjectId in interface PersistenceManagerPersistenceManager.getObjectId(Object pc),
PersistenceManager.getObjectById(Object oid)public void setRequireCopyObjectId(boolean flag)
PersistenceManager.getObjectId(Object pc)
and PersistenceManager.getObjectById(Object oid) requests.setRequireCopyObjectId in interface PersistenceManagerflag - boolean requireCopyObjectId flagPersistenceManager.getObjectId(Object pc),
PersistenceManager.getObjectById(Object oid)public boolean getRequireTrackedSCO()
getRequireTrackedSCO in interface PersistenceManagerpublic void setRequireTrackedSCO(boolean flag)
setRequireTrackedSCO in interface PersistenceManagerflag - boolean requireTrackedSCO flagpublic Class getObjectIdClass(Class cls)
getObjectIdClass in interface PersistenceManagercls - the PersistenceCapable Classpublic Object newSCOInstance(Class type, Object owner, String fieldName)
newSCOInstance in interface PersistenceManagertype - Class of the new SCO instanceowner - the owner to notify upon changesfieldName - the field to notify upon changespublic Object newCollectionInstance(Class type, Object owner, String fieldName, Class elementType, boolean allowNulls, int initialSize)
newCollectionInstance in interface PersistenceManagertype - Class of the new SCO instanceowner - the owner to notify upon changesfieldName - the field to notify upon changeselementType - the element types allowedallowNulls - true if allowedinitialSize - initial size of the Collectionpublic PersistenceManager getPersistenceManager()
Copyright © 2017. All rights reserved.