org.formaria.data.pojo
Class PersistenceController

java.lang.Object
  extended by org.formaria.data.pojo.PersistenceController
All Implemented Interfaces:
PojoContext, PojoRoot

public abstract class PersistenceController
extends java.lang.Object
implements PojoContext

The interface between the application and the persistent store.

Copyright (c) Formaria Ltd., 2008
License: see license.txt


Constructor Summary
PersistenceController()
           
 
Method Summary
abstract  void beginTransaction()
          Starts a new database transaction.
 void beginWorkUnit()
          Marks the beginning of a unit of work.
 void beginWorkUnit(boolean lazy)
          Marks the beginning of a unit of work.
abstract  void commitTransaction()
          Flushes the session and ends the underlying transaction.
abstract  void delete(java.lang.Object pojo)
          Removes the given POJO from the persistent store.
 void endWorkUnit()
          Marks the end of a unit of work.
abstract  void evict(java.lang.Object pojo)
          Removes the underlying POJO from the persistence context.
abstract  void flush()
          Flushes this session.
abstract  java.lang.Object getTransactionObject()
          Returns the object representing the underlying database transaction.
abstract  boolean isTransactionActive()
          Indicates whether the underlying transaction is active.
 boolean isWorkUnitOpen()
          Check if the work unit is open.
abstract  void lock(java.lang.Object pojo)
          Persists the given POJO without making any changes in the persistent store.
abstract  java.lang.Object merge(java.lang.Object pojo)
          Copies the given POJO to the persistence context.
abstract  void persist(java.lang.Object pojo)
          Persists the given POJO.
abstract  void rollbackTransaction()
          Rollbacks the underlying transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.formaria.data.pojo.PojoContext
getRoot, init
 
Methods inherited from interface org.formaria.data.pojo.PojoRoot
configure, modelLoaded
 

Constructor Detail

PersistenceController

public PersistenceController()
Method Detail

beginWorkUnit

public void beginWorkUnit()
Marks the beginning of a unit of work. The underlying database transaction will be started "on demand".


beginWorkUnit

public void beginWorkUnit(boolean lazy)
Marks the beginning of a unit of work.

Parameters:
lazy - true if the database transaction should be started immediately, false if it should be started on demand

endWorkUnit

public void endWorkUnit()
Marks the end of a unit of work. Flushes the persistent context, commits the underlying database transaction.


isWorkUnitOpen

public boolean isWorkUnitOpen()
Check if the work unit is open.


beginTransaction

public abstract void beginTransaction()
Starts a new database transaction.


commitTransaction

public abstract void commitTransaction()
Flushes the session and ends the underlying transaction.


rollbackTransaction

public abstract void rollbackTransaction()
Rollbacks the underlying transaction.


isTransactionActive

public abstract boolean isTransactionActive()
Indicates whether the underlying transaction is active.


persist

public abstract void persist(java.lang.Object pojo)
Persists the given POJO.


delete

public abstract void delete(java.lang.Object pojo)
Removes the given POJO from the persistent store.


evict

public abstract void evict(java.lang.Object pojo)
Removes the underlying POJO from the persistence context.


merge

public abstract java.lang.Object merge(java.lang.Object pojo)
Copies the given POJO to the persistence context.


lock

public abstract void lock(java.lang.Object pojo)
Persists the given POJO without making any changes in the persistent store.


getTransactionObject

public abstract java.lang.Object getTransactionObject()
Returns the object representing the underlying database transaction.

Returns:
the transaction object.

flush

public abstract void flush()
Flushes this session.