uk.co.kimble.cobra
Class PersistentSource

java.lang.Object
  |
  +--uk.co.kimble.cobra.PersistentSource

public class PersistentSource
extends java.lang.Object

A PersistentSource gives a user access to the underlying persistence mechanism.


Constructor Summary
PersistentSource()
          Constructor
 
Method Summary
 int delete(PersistentObject persistent_object)
          Delete an PersistentObject from the persistence mechanism
 int delete(java.lang.String class_name, PersistentCriteria criteria)
          Deletes a set (that is more than 1) of objects based on some criteria
 PersistentObject retrieve(PersistentObject persistent_object)
          Retrieves an object's attributes from a database table row, the database and table are located throught the data dictionary and the row is identified by the primary key(s).
 PersistentSet retrieve(java.lang.String class_name)
          Retrieves a set (that is more than 1) of objects based on some criteria
 PersistentSet retrieve(java.lang.String class_name, PersistentCriteria criteria)
          Retrieves a set (that is more than 1) of objects based on some criteria
 int save(PersistentObject persistent_object)
          Saves a persistent_object to the store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentSource

public PersistentSource()
Constructor
Method Detail

delete

public int delete(PersistentObject persistent_object)
           throws PersistentException
Delete an PersistentObject from the persistence mechanism
Parameters:
po - Persistent object to be deleted
Throws:
PersistentException -  

delete

public int delete(java.lang.String class_name,
                  PersistentCriteria criteria)
           throws PersistentException
Deletes a set (that is more than 1) of objects based on some criteria
Parameters:
po - Persistent object to be deleted
criteria - Criteria for deletion
Throws:
PersistentException -  

save

public int save(PersistentObject persistent_object)
         throws PersistentException
Saves a persistent_object to the store. If object is new an SQL insert will be performed otherwise an update.

retrieve

public PersistentObject retrieve(PersistentObject persistent_object)
                          throws PersistentException
Retrieves an object's attributes from a database table row, the database and table are located throught the data dictionary and the row is identified by the primary key(s).

Parameters:
A - persistent object
Throws:
PersisentException -
  1. if the PersistentStream does not match the Object type,
  2. if the key fields are not set
  3. if the class cannot be loaded

    retrieve

    public PersistentSet retrieve(java.lang.String class_name)
                           throws PersistentException
    Retrieves a set (that is more than 1) of objects based on some criteria

    Throws:
    PersisentException - if the set can't be retrieved

    retrieve

    public PersistentSet retrieve(java.lang.String class_name,
                                  PersistentCriteria criteria)
                           throws PersistentException
    Retrieves a set (that is more than 1) of objects based on some criteria

    Parameters:
    criteria - Criteria for retrieval
    Throws:
    PersisentException - if the set can't be retrieved