Package org.exolab.castor.jdo
Interface Persistent
public interface Persistent
A callback informs objects about changes to their state.
- Version:
- $Revision: 8623 $ $Date: 2005-04-17 04:29:33 -0600 (Sun, 17 Apr 2005) $
- Author:
- Assaf Arkin
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Called to indicate that an object has been created in persistent storage.void
Called to indicate that an object has been removed from persistent storage.void
Called to indicate that an object is to be created in persistent storage.void
Called to indicate that an object is to be removed from persistent storage.jdoLoad
(AccessMode accessMode) Called to indicate that the object has been loaded from persistent storage.void
Called to indicate that an object has been modified and is to be stored in persistent storage.void
Called to set the database to which this object belongs when this object becomes persistent.void
jdoStore
(boolean modified) Called to indicate that an object is to be stored in persistent storage.void
Called to indicate the object is now transient.void
Called to indicate that an object has been included to the current transaction by means of db.update() method (at the end of a "long " transaction).
-
Method Details
-
jdoPersistent
Called to set the database to which this object belongs when this object becomes persistent. The object may use the database to load/create/delete related objects.Called when the object is first created as the result of a query, perior to calling
jdoLoad(org.exolab.castor.mapping.AccessMode)
, or afterDatabase.create(java.lang.Object)
has been called on the object, prior to callingjdoStore(boolean)
.- Parameters:
db
- The database to which this object belongs
-
jdoTransient
void jdoTransient()Called to indicate the object is now transient. The object may no longer use the database object assigned to it, and will become hollow with various fields set to null.Called when the object #setFacetscompletes following any call to
jdoStore(boolean)
or when the object is deleted from the database. -
jdoLoad
Called to indicate that the object has been loaded from persistent storage. This method is called immediately after synchronizing an object with the database.- Parameters:
accessMode
- The access mode that was specified for this object either inQuery.execute(AccessMode accessMode)
, or inDatabase.load(Class type, Object identity, AccessMode accessMode)
. The constants are defined inDatabase
.- Returns:
- the return value is discarded
- Throws:
Exception
- An exception occured, the object cannot be loaded
-
jdoModify
Called to indicate that an object has been modified and is to be stored in persistent storage.- Throws:
Exception
- An exception occurred, the object cannot be modified
-
jdoStore
Called to indicate that an object is to be stored in persistent storage. This method is called at commit time on all persistent objects in this transaction. Managed fields may not necessarily be persisted if the object has not been identified as modified.- Parameters:
modified
- Is the object modified?- Throws:
Exception
- An exception occured, the object cannot be stored
-
jdoBeforeCreate
Called to indicate that an object is to be created in persistent storage. This method is called during db.create().- Parameters:
db
- The database in which this object will be created- Throws:
Exception
-
jdoAfterCreate
Called to indicate that an object has been created in persistent storage. This method is called during db.create().- Throws:
Exception
-
jdoBeforeRemove
Called to indicate that an object is to be removed from persistent storage. This method is called during db.remove().- Throws:
Exception
-
jdoAfterRemove
Called to indicate that an object has been removed from persistent storage. This method is called during db.remove().- Throws:
Exception
-
jdoUpdate
Called to indicate that an object has been included to the current transaction by means of db.update() method (at the end of a "long " transaction).- Throws:
Exception
- An exception occured, the object cannot be stored
-