org.datanucleus.store
Interface StorePersistenceHandler

All Known Implementing Classes:
AbstractPersistenceHandler

public interface StorePersistenceHandler

Interface defining persistence operations of a StoreManager. This performs the low level communication with the actual datastore.


Method Summary
 void batchEnd(ObjectManager om)
          Signal that a batch of operations are ending for the specified ObjectManager.
 void batchStart(ObjectManager om)
          Signal that a batch of operations are starting for the specified ObjectManager.
 void close()
          Method to close the persistence handler, and release any resources.
 void deleteObject(StateManager sm)
          Deletes a persistent object from the datastore.
 void fetchObject(StateManager sm, int[] fieldNumbers)
          Fetches a persistent object from the database.
 java.lang.Object findObject(ObjectManager om, java.lang.Object id)
          Method to find a persistable object with the specified id from the datastore, if the StoreManager supports this operation (optional).
 java.lang.Object[] findObjects(ObjectManager om, java.lang.Object[] ids)
          Method to find an array of objects with the specified identities from the datastore.
 void insertObject(StateManager sm)
          Inserts a persistent object into the database.
 void locateObject(StateManager sm)
          Locates this object in the datastore.
 void locateObjects(StateManager[] sms)
          Locates object(s) in the datastore.
 void updateObject(StateManager sm, int[] fieldNumbers)
          Updates a persistent object in the datastore.
 

Method Detail

close

void close()
Method to close the persistence handler, and release any resources.


batchStart

void batchStart(ObjectManager om)
Signal that a batch of operations are starting for the specified ObjectManager. This is usually a batch persist, or batch delete.

Parameters:
om - The object manager

batchEnd

void batchEnd(ObjectManager om)
Signal that a batch of operations are ending for the specified ObjectManager. This is usually a batch persist, or batch delete.

Parameters:
om - The object manager

insertObject

void insertObject(StateManager sm)
Inserts a persistent object into the database.

Parameters:
sm - The state manager of the object to be inserted.
Throws:
NucleusDataStoreException - when an error occurs in the datastore communication

updateObject

void updateObject(StateManager sm,
                  int[] fieldNumbers)
Updates a persistent object in the datastore.

Parameters:
sm - The state manager of the object to be updated.
fieldNumbers - The numbers of the fields to be updated.
Throws:
NucleusDataStoreException - when an error occurs in the datastore communication

deleteObject

void deleteObject(StateManager sm)
Deletes a persistent object from the datastore.

Parameters:
sm - The state manager of the object to be deleted.
Throws:
NucleusDataStoreException - when an error occurs in the datastore communication

fetchObject

void fetchObject(StateManager sm,
                 int[] fieldNumbers)
Fetches a persistent object from the database.

Parameters:
sm - The state manager of the object to be fetched.
fieldNumbers - The numbers of the fields to be fetched.
Throws:
NucleusObjectNotFoundException - if the object doesn't exist
NucleusDataStoreException - when an error occurs in the datastore communication

locateObject

void locateObject(StateManager sm)
Locates this object in the datastore.

Parameters:
sm - The StateManager for the object to be found
Throws:
NucleusObjectNotFoundException - if the object doesn't exist
NucleusDataStoreException - when an error occurs in the datastore communication

locateObjects

void locateObjects(StateManager[] sms)
Locates object(s) in the datastore.

Parameters:
sms - StateManager(s) for the object(s) to be found
Throws:
NucleusObjectNotFoundException - if an object doesn't exist
NucleusDataStoreException - when an error occurs in the datastore communication

findObject

java.lang.Object findObject(ObjectManager om,
                            java.lang.Object id)
Method to find a persistable object with the specified id from the datastore, if the StoreManager supports this operation (optional). This allows for datastores that perform the instantiation of objects directly (such as ODBMS). With other types of datastores (e.g RDBMS) this method returns null.

Parameters:
om - the ObjectManager which will manage the object
id - the id of the object in question.
Returns:
a persistable object with a valid object state (for example: hollow) or null, indicating that the implementation leaves the instantiation work to DataNucleus.
Throws:
NucleusObjectNotFoundException - if this route is supported yet the object doesn't exist
NucleusDataStoreException - when an error occurs in the datastore communication

findObjects

java.lang.Object[] findObjects(ObjectManager om,
                               java.lang.Object[] ids)
Method to find an array of objects with the specified identities from the datastore. This allows for datastores that perform the instantiation of objects directly (such as ODBMS). With other types of datastores (e.g RDBMS) this method returns null.

Parameters:
om - the ObjectManager which will manage the object
ids - identities of the object(s) to retrieve
Returns:
The persistable objects with these identities (in the same order as
ids
)
Throws:
NucleusObjectNotFoundException - if an object doesn't exist
NucleusDataStoreException - when an error occurs in the datastore communication


Copyright © 2010. All Rights Reserved.