Methods Summary |
---|
public void | close()A PersistenceManager instance can be used until it is closed.
This method closes the PersistenceManager, which if pooled, releases it
to the pool of available PersistenceManagers.
if (isValid) {
isValid = false;
pm.popCurrentWrapper(prev);
pm = null;
prev = null;
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public Transaction | currentTransaction()There is exactly one Transaction associated with a PersistenceManager.
if (isValid) {
return pm.currentTransaction();
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public void | deletePersistent(java.lang.Object pc)Delete the persistent instance from the data store.
This method must be called in an active transaction.
The data store object will be removed at commit.
Unlike makePersistent, which makes the closure of the instance persistent,
the closure of the instance is not deleted from the data store.
This method has no effect if the instance is already deleted in the
current transaction.
This method throws an exception if the instance is transient or is managed by another
PersistenceManager.
if (isValid) {
pm.deletePersistent(pc);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public void | deletePersistent(java.lang.Object[] pcs)Delete an array of instances from the data store.
if (isValid) {
pm.deletePersistent(pcs);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public void | deletePersistent(java.util.Collection pcs)Delete a Collection of instances from the data store.
if (isValid) {
pm.deletePersistent(pcs);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public java.util.Collection | getExtent(java.lang.Class persistenceCapableClass, boolean subclasses)The PersistenceManager may manage a collection of instances in the data
store based on the class of the instances. This method returns a
Collection of instances in the data store that might be iterated or
given to a Query as the Collection of candidate instances.
if (isValid) {
return pm.getExtent(persistenceCapableClass, subclasses);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public java.lang.Object | getObjectById(java.lang.Object oid)This method locates a persistent instance in the cache of instances
managed by this PersistenceManager. If an instance with the same ObjectId
is found it is returned. Otherwise, a new instance is created and
associated with the ObjectId.
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.
if (isValid) {
return pm.getObjectById(oid);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public java.lang.Object | getObjectById(java.lang.Object oid, boolean validate)This method locates a persistent instance in the cache of instances
managed by this 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.
if (isValid) {
return pm.getObjectById(oid, validate);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public java.lang.Object | getObjectId(java.lang.Object pc)The ObjectId returned by this method represents the JDO identity of
the instance. The ObjectId is a copy (clone) of the internal state
of the instance, and changing it does not affect the JDO identity of
the instance.
if (isValid) {
return pm.getObjectId(pc);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public java.lang.Class | getObjectIdClass(java.lang.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.
if (isValid) {
return pm.getObjectIdClass(cls);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public PersistenceManager | getPersistenceManager()
return (PersistenceManager) pm;
|
public PersistenceManagerFactory | getPersistenceManagerFactory()This method returns the PersistenceManagerFactory used to create
this PersistenceManager. It returns null if this instance was
created via a constructor.
if (isValid) {
return pm.getPersistenceManagerFactory();
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public java.util.Properties | getProperties()The JDO vendor might store certain non-operational properties and
make those properties available to applications (for troubleshooting).
Standard properties include:
VendorName
VersionNumber
if (isValid) {
return pm.getProperties();
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public boolean | getRequireCopyObjectId()Returns the boolean value of the requireCopyObjectId flag
for this PersistenceManager. If set to false, the PersistenceManager
does not create a copy of an ObjectId for PersistenceManager.getObjectId(Object pc)
and PersistenceManager.getObjectById(Object oid) requests.
if (isValid) {
return pm.getRequireCopyObjectId();
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public boolean | getRequireTrackedSCO()Returns the boolean value of the requireTrackedSCO flag
for this PersistenceManager. If set to false, the PersistenceManager
will not create tracked SCO instances for
new persistent instances at commit with retainValues set to true
and while retrieving data from a datastore.
if (isValid) {
return pm.getRequireTrackedSCO();
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public boolean | getSupersedeDeletedInstance()Returns the boolean value of the supersedeDeletedInstance flag
for this PersistenceManager. If set to true, deleted instances are
allowed to be replaced with persistent-new instances with the equal
Object Id.
if (isValid) {
return pm.getSupersedeDeletedInstance();
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public java.lang.Object | getTransactionalInstance(java.lang.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.
if (isValid) {
return pm.getTransactionalInstance(pc);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public java.lang.Object | getUserObject()The application can manage the PersistenceManager instances
more easily by having an application object associated with each
PersistenceManager instance.
if (isValid) {
return pm.getUserObject();
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public boolean | isClosed()A PersistenceManager instance can be used until it is closed.
if (isValid) {
return pm.isClosed();
} else {
return true;
}
|
public void | makePersistent(java.lang.Object pc)Make the transient instance persistent in this PersistenceManager.
This method must be called in an active transaction.
The PersistenceManager assigns an ObjectId to the instance and
transitions it to persistent-new.
The instance will be managed in the Extent associated with its Class.
The instance will be put into the data store at commit.
if (isValid) {
pm.makePersistent(pc);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public void | makePersistent(java.lang.Object[] pcs)Make an array of instances persistent.
if (isValid) {
pm.makePersistent(pcs);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public void | makePersistent(java.util.Collection pcs)Make a Collection of instances persistent.
if (isValid) {
pm.makePersistent(pcs);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public java.lang.Object | newCollectionInstance(java.lang.Class type, java.lang.Object owner, java.lang.String fieldName, java.lang.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.
The collection class restricts the element types allowed to the elementType or
instances assignable to the elementType, and allows nulls to be added as
elements based on the setting of allowNulls. The Collection has an initial size
as specified by the initialSize parameter.
if (isValid) {
return pm.newCollectionInstance(type, owner, fieldName, elementType, allowNulls, initialSize);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public Query | newQuery(java.lang.Class cls, java.util.Collection cln, java.lang.String filter)Create a new Query with the Class of the results, candidate Collection,
and Filter.
if (isValid) {
return pm.newQuery(cls, cln, filter);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public Query | newQuery()Create a new Query with no elements.
if (isValid) {
return pm.newQuery();
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public Query | newQuery(java.lang.Object compiled)Create a new Query using elements from another Query. The other Query
must have been created by the same JDO implementation. It might be active
in a different PersistenceManager or might have been serialized and
restored.
if (isValid) {
return pm.newQuery(compiled);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public Query | newQuery(java.lang.Class cls)Create a new Query specifying the Class of the results.
if (isValid) {
return pm.newQuery(cls);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public Query | newQuery(java.lang.Class cls, java.util.Collection cln)Create a new Query with the Class of the results and candidate Collection.
specified.
if (isValid) {
return pm.newQuery(cls, cln);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public Query | newQuery(java.lang.Class cls, java.lang.String filter)Create a new Query with the Class of the results and Filter.
specified.
if (isValid) {
return pm.newQuery(cls, filter);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public java.lang.Object | newSCOInstance(java.lang.Class type, java.lang.Object owner, java.lang.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. If a collection class is created, then the
class does not restrict the element types, and allows nulls to be added as elements.
if (isValid) {
return pm.newSCOInstance(type, owner, fieldName);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public void | setRequireCopyObjectId(boolean flag)Sets the requireCopyObjectId flag for this PersistenceManager.
If set to false, the PersistenceManager will not create a copy of
an ObjectId for PersistenceManager.getObjectId(Object pc)
and PersistenceManager.getObjectById(Object oid) requests.
if (isValid) {
pm.setRequireCopyObjectId(flag);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public void | setRequireTrackedSCO(boolean flag)Sets the requireTrackedSCO flag for this PersistenceManager.
If set to false, the PersistenceManager will not create tracked
SCO instances for new persistent instances at commit with retainValues
set to true and while retrieving data from a datastore.
if (isValid) {
pm.setRequireTrackedSCO(flag);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public void | setSupersedeDeletedInstance(boolean flag)Sets the supersedeDeletedInstance flag for this PersistenceManager.
if (isValid) {
pm.setSupersedeDeletedInstance(flag);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|
public void | setUserObject(java.lang.Object o)The application can manage the PersistenceManager instances
more easily by having an application object associated with each
PersistenceManager instance.
if (isValid) {
pm.setUserObject(o);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerwrapper.invalidpm"));// NOI18N
}
|