|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.jdo.JDOHelper
This class can be used by a JDO-aware application to call the JDO behavior of PersistenceCapable instances without declaring them to be PersistenceCapable.
Every class whose instances can be managed by a JDO PersistenceManager must implement the PersistenceCapable interface.
This helper class defines static methods that allow a JDO-aware application to examine the runtime state of instances. For example, an application can discover whether the instance is persistent, transactional, dirty, new, or deleted; and to get its associated PersistenceManager if it has one.
Constructor Summary | |
JDOHelper()
|
Method Summary | |
static java.lang.Object |
getObjectId(java.lang.Object pc)
Return a copy of the JDO identity associated with this instance. |
static PersistenceManager |
getPersistenceManager(java.lang.Object pc)
Return the associated PersistenceManager if there is one. |
static java.lang.Object |
getTransactionalObjectId(java.lang.Object pc)
Return a copy of the JDO identity associated with this instance. |
static boolean |
isDeleted(java.lang.Object pc)
Tests whether this object has been deleted. |
static boolean |
isDirty(java.lang.Object pc)
Tests whether this object is dirty. |
static boolean |
isNew(java.lang.Object pc)
Tests whether this object has been newly made persistent. |
static boolean |
isPersistent(java.lang.Object pc)
Tests whether this object is persistent. |
static boolean |
isTransactional(java.lang.Object pc)
Tests whether this object is transactional. |
static void |
makeDirty(java.lang.Object pc,
java.lang.String fieldName)
Explicitly mark this instance and this field dirty. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JDOHelper()
Method Detail |
public static PersistenceManager getPersistenceManager(java.lang.Object pc)
Transient non-transactional instances and instances of classes that do not implement PersistenceCapable return null.
pc
- the PersistenceCapable instance.
PersistenceCapable.jdoGetPersistenceManager()
public static void makeDirty(java.lang.Object pc, java.lang.String fieldName)
Transient instances and instances of classes that do not implement PersistenceCapable ignore this method.
pc
- the PersistenceCapable instance.fieldName
- the name of the field to be marked dirty.PersistenceCapable.jdoMakeDirty(String fieldName)
public static java.lang.Object getObjectId(java.lang.Object pc)
Persistent instances of PersistenceCapable classes have a JDO identity managed by the PersistenceManager. This method returns a copy of the ObjectId that represents the JDO identity.
Transient instances and instances of classes that do not implement PersistenceCapable return null.
The ObjectId may be serialized and later restored, and used with a PersistenceManager from the same JDO implementation to locate a persistent instance with the same data store identity.
If the JDO identity is managed by the application, then the ObjectId may be used with a PersistenceManager from any JDO implementation that supports the PersistenceCapable class.
If the JDO identity is not managed by the application or the data store, then the ObjectId returned is only valid within the current transaction.
pc
- the PersistenceCapable instance.
PersistenceManager.getObjectId(Object pc)
,
PersistenceCapable.jdoGetObjectId()
,
PersistenceManager.getObjectById(Object oid, boolean validate)
public static java.lang.Object getTransactionalObjectId(java.lang.Object pc)
pc
- the PersistenceCapable instance.
PersistenceCapable.jdoGetTransactionalObjectId()
,
PersistenceManager.getObjectById(Object oid, boolean validate)
public static boolean isDirty(java.lang.Object pc)
Transient instances and instances of classes that do not implement PersistenceCapable return false.
pc
- the PersistenceCapable instance.
StateManager.makeDirty(Object pc, String fieldName)
,
PersistenceCapable.jdoIsDirty()
public static boolean isTransactional(java.lang.Object pc)
Transient instances and instances of classes that do not implement PersistenceCapable return false.
pc
- the PersistenceCapable instance.
PersistenceCapable.jdoIsTransactional()
public static boolean isPersistent(java.lang.Object pc)
Transient instances and instances of classes that do not implement PersistenceCapable return false.
pc
- the PersistenceCapable instance.
PersistenceManager.makePersistent(Object pc)
,
PersistenceCapable.jdoIsPersistent()
public static boolean isNew(java.lang.Object pc)
Transient instances and instances of classes that do not implement PersistenceCapable return false.
pc
- the PersistenceCapable instance.
PersistenceManager.makePersistent(Object pc)
,
PersistenceCapable.jdoIsNew()
public static boolean isDeleted(java.lang.Object pc)
Transient instances and instances of classes that do not implement PersistenceCapable return false.
pc
- the PersistenceCapable instance.
PersistenceManager.deletePersistent(Object pc)
,
PersistenceCapable.jdoIsDeleted()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |