| java.lang.Object org.jaffa.persistence.UOW
UOW | public class UOW (Code) | | The UOW (Unit of Work) is the application developers interface to the persistence layer.
Through this all writes, updates and deletes are executed.
The UOW also provides the querying mechanism against the persistent store.
|
Constructor Summary | |
public | UOW() Creates new UOW. |
Method Summary | |
public void | acquireLock(Object object) This will acquire a lock on the database row corrsponding to the input persistent object.
Parameters: object - The persistent object to be locked. | public void | add(Object object) Adds an object to the UOW for addition to the persistent store.
The persistence engine may choose to add the object(s) only on a commit .
Parameters: object - The object to persist. | public void | commit() Objects that have been added, objects that have been deleted,
and objects that have been updated, will all be persisted via
an invocation of this method. | public void | delete(Object object) Adds an object to the UOW for deletion from the persistent store.
The persistence engine may choose to delete the object(s) only on a commit .
Parameters: object - The object to delete from persistent storage. | protected void | finalize() This invokes the rollback() method, which will rollback & close the connection(if still open). | public Class | getActualPersistentClass(Object persistentObject) This is a helper method to determine the actual class which was used to create an IPersistent instance.
It is quite possible that the input object is a dynamic proxy.
Parameters: object - The object which implements the IPersistent instance. | public boolean | isActive() Returns true if the UOW is active. | public IPersistent | newPersistentInstance(Class persistentClass) Generates an appropriate instance for the input persistentClass.
If the persistentClass is a 'Class', then it should implement the 'IPersistent' interface. | public Collection | query(Criteria criteria) Queries the underlying persistent store based on the search profile passed in the
Criteria object.
Parameters: criteria - search profile for the query. | public void | rollback() Rollbacks all the additions, deletions, updations. | public void | update(Object object) Adds an object to the UOW for updation to the persistent store.
The persistence engine may choose to update the object(s) only on a commit .
Parameters: object - The object to update. |
UOW | public UOW() throws UOWException(Code) | | Creates new UOW. A connection is established with the underlying persistence store.
throws: UOWException - if any error occurs during the process. |
acquireLock | public void acquireLock(Object object) throws AlreadyLockedObjectException(Code) | | This will acquire a lock on the database row corrsponding to the input persistent object.
Parameters: object - The persistent object to be locked. It should implement the IPersistent interface. throws: AlreadyLockedObjectException - if the database row has been locked by another process. |
add | public void add(Object object) throws AddFailedException(Code) | | Adds an object to the UOW for addition to the persistent store.
The persistence engine may choose to add the object(s) only on a commit .
Parameters: object - The object to persist. It should implement the IPersistent interface. throws: AddFailedException - if any error occurs during the process. |
delete | public void delete(Object object) throws DeleteFailedException(Code) | | Adds an object to the UOW for deletion from the persistent store.
The persistence engine may choose to delete the object(s) only on a commit .
Parameters: object - The object to delete from persistent storage. It should implement the IPersistent interface. throws: DeleteFailedException - if any error occurs during the process. |
finalize | protected void finalize() throws Throwable(Code) | | This invokes the rollback() method, which will rollback & close the connection(if still open).
throws: Throwable - if any error occurs. |
getActualPersistentClass | public Class getActualPersistentClass(Object persistentObject)(Code) | | This is a helper method to determine the actual class which was used to create an IPersistent instance.
It is quite possible that the input object is a dynamic proxy.
Parameters: object - The object which implements the IPersistent instance. The class which was used for instantiating the instance. |
isActive | public boolean isActive()(Code) | | Returns true if the UOW is active. The UOW becomes inactive after a commit or a rollback.
true if the UOW is active. |
newPersistentInstance | public IPersistent newPersistentInstance(Class persistentClass)(Code) | | Generates an appropriate instance for the input persistentClass.
If the persistentClass is a 'Class', then it should implement the 'IPersistent' interface. The persistence engine will simply instantiate the class.
If the persistentClass is an 'Interface', then the persistence engine will generate a dynamic proxy, to implement the IPersistent and the 'persistentClass' interfaces.
Parameters: persistentClass - The actual persistentClass which can represent a 'Class' or an 'Interface' an instance implementing the IPersistent interface. |
rollback | public void rollback() throws RollbackFailedException(Code) | | Rollbacks all the additions, deletions, updations.
Note: This object will free up its connection to the database, and will no longer be available.
throws: RollbackFailedException - if any error occurs during the process. |
update | public void update(Object object) throws UpdateFailedException(Code) | | Adds an object to the UOW for updation to the persistent store.
The persistence engine may choose to update the object(s) only on a commit .
Parameters: object - The object to update. It should implement the IPersistent interface. throws: UpdateFailedException - if any error occurs during the process. |
|
|