org.exolab.castor.jdo
Interface Persistent


public interface Persistent

A callback informs objects about changes to their state.

Version:
$Revision: 1.1.1.1 $ $Date: 2003/03/03 07:08:08 $
Author:
Assaf Arkin

Method Summary
 void jdoAfterCreate()
          Called to indicate that an object has been created in persistent storage.
 void jdoAfterRemove()
          Called to indicate that an object has been removed from persistent storage.
 void jdoBeforeCreate(Database db)
          Called to indicate that an object is to be created in persistent storage.
 void jdoBeforeRemove()
          Called to indicate that an object is to be removed from persistent storage.
 java.lang.Class jdoLoad(short accessMode)
          Called to indicate that the object has been loaded from persistent storage.
 void jdoPersistent(Database db)
          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 jdoTransient()
          Called to indicate the object is now transient.
 void 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).
 

Method Detail

jdoPersistent

public void jdoPersistent(Database db)
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(short), or after Database.create(java.lang.Object) has been called on the object, prior to calling jdoStore(boolean).

Parameters:
db - The database to which this object belongs

jdoTransient

public 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

public java.lang.Class jdoLoad(short accessMode)
                        throws java.lang.Exception
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 in Query.execute( short accessMode ), or in Database.load( Class type, Object identity, short accessMode ). The constants are defined in Database.
Returns:
the return value is discarded
Throws:
java.lang.Exception - An exception occured, the object cannot be loaded

jdoStore

public void jdoStore(boolean modified)
              throws java.lang.Exception
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:
java.lang.Exception - An exception occured, the object cannot be stored

jdoBeforeCreate

public void jdoBeforeCreate(Database db)
                     throws java.lang.Exception
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:
java.lang.Exception

jdoAfterCreate

public void jdoAfterCreate()
                    throws java.lang.Exception
Called to indicate that an object has been created in persistent storage. This method is called during db.create().

Throws:
java.lang.Exception

jdoBeforeRemove

public void jdoBeforeRemove()
                     throws java.lang.Exception
Called to indicate that an object is to be removed from persistent storage. This method is called during db.remove().

Throws:
java.lang.Exception

jdoAfterRemove

public void jdoAfterRemove()
                    throws java.lang.Exception
Called to indicate that an object has been removed from persistent storage. This method is called during db.remove().

Throws:
java.lang.Exception

jdoUpdate

public void jdoUpdate()
               throws java.lang.Exception
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:
java.lang.Exception - An exception occured, the object cannot be stored


Intalio Inc. (C) 1999-2004. All rights reserved http://www.intalio.com